Clickalgo Knowledge Center
Return to Website

How to BackTest a cTrader cBot

Backtesting is the process of testing an automated trading strategy using historical data to ensure its viability before the trader risks running it on a live account. The trader can simulate the trading of a strategy over a defined period of time and analyse the results for the levels of profitability and risk.


Why Do You Need to Back-Test?

Running backtests is one of the most important aspects of developing a trading system as it can help traders optimize and improve their strategies, find any technical or general flaws, as well as gain confidence in their strategy before applying it to real-world markets.


Manually Adjust Symbol Parameters

One option is to manually adjust your cBot parameters and run a backtest, this is our preferred method as you are not fitting the sample data to your settings and when you start using fresh data you may have a higher probability of good results, but this is not always the case as sometimes fitted data from using optimized parameters can also provide excellent results with fresh data. It is best to experiment with both manual and optimized parameters.


Important Information

You should never backtest or optimise your trading system on a virtual private server (VPS), this is due to the fact that they use a huge amount of RAM and CPU to crunch the numbers, instead, you should backtest and optimise on a powerful PC and when you have the desired settings you can apply these to the VPS server.


Hot Tip

If you have optimised using 1-min bar data which is much faster, it may be worth then backtesting using tick-data to verify the results, tick data includes the historical spread and is deemed more accurate, but in our findings, there is not much difference between 1-min bar at and tick data using symbols with small spreads.


How to Back-Test Your cBot

This article assumes that you already have a good set of symbol parameters are you just want to run tests with historical data to simulate live trading, the cTrader platform has a module for backtesting and to get started you first need to make sure you are looking at the automated trading screen, just click on the button shown in green on the left-hand side of the screen to open it.

cTrader Automate Screen


Step 1

Your first step is to add a symbol instance to the robot you wish to backtest.


You will see the default parameters shown in the cBot, you can either manually adjust them or load predefined parameter settings.


Your next step is to click on the backtesting tab shown at the top of the screen.


cTrader Backtesting Settings


The image above shows the backtest screen ready for configuration, your first step is to set the date range of the test, above you can see it is from the 09/10/2018 to the 08/11/2018, you can use any date you wish by either using your mouse to adjust the slider or changing the start and end dates.


Step 2

Once you are sure that you have the settings you want in the cBot, your next step is to configure your backtest settings for the trading you want to simulate.


cTrader Backtest Configuration Settings


 Backtest Settings

  • Starting Capital - this is the trading capital that you want to simulate.
  • Commission - this is the commission your broker charges per million, you can find this information on your broker's website.
  • Data - This is the type you wish to use, the m1 bars will provide the open prices only, the spread is in-built and can be set as a fixed value.
  • Spread - this is the fixed spread you wish to use for all trades, this is not available for tick data.
  • Random - this is the random spread you wish to use between the minimum and maximum values, this is not available for tick data.

** If you use Tick Data then the real historical spread is included in the data.


Step 3

The final step is to run the backtest, to do this just click on the play button at the top right, if you have the history tab open beneath you will see the actual historical simulated trades.


cTrader Backtest Simulation


What Is Visual Mode?

The visual mode feature built into the cTrader platform is a game-changer, this allows you to visually see the trading system in action, try it out by checking the box and running a backtest, you can adjust the speed on the right-hand side to speed things up or slow it down. Also, open the historical trades tab below to see the life of trade from birth to death.


Need Help Backtesting?

If you need any help using the backtesting feature of cTrader then please post a message on our support forum for a detailed reply.


What is Drawdown?

When you run you're backtesting you will need to check how much of your account equity and balance was at risk, this means at any point what was the maximum amount of money you were losing if your drawdown was 50% than if at that point you closed all your open positions you would have lost half your money.


Common Problems

Some common problems that may occur when you run a backtest and no results are shown are explained below.


  • Max Spread: Sometimes no results are shown when you run a backtest because the Max Spread parameter in the robot is higher than the fixed spread that has been set in the backtest settings if this happens just set the max spread parameter in the robot to a much higher value.
  • Incorrect Parameter Settings:  Another common problem is that one or more parameters in the cBot are incorrect.
  • Incorrect Logic In cBot:  If you have created the trading robot yourself or downloaded it from another company then there could be a problem in the actual logic of the trading system.


Need More Help? Watch This Video

The video has been uploaded to 1080p High Quality, so do not forget to set your U-Tube video quality to 1080p HD. 

Expand to full screen with icon bottom right of the video.


cTrader Backtesting Overview Video


How to Buy Historical Market Data

If you wish to purchase and download historical market data for the cTrader trading platform for any symbol then we can provide you with the data, if we do not have the data in our web store then just contact us and we will create it for you.