cTrader Backtesting Help
Backtesting a cTrader trading robot is a way to see how your trading strategy would have performed using historical market data. This is like running a test drive for your trading system without risking any real money. Backtesting is crucial to understand your cBots strengths, weaknesses, and overall potential and to build confidence before using it in live trading.
cTrader has three applications, Trade, Copy and Algo, you need to select the Algo application as this is used for running, creating, backtesting and optimising your automated trading strategies (cBots).
Getting Started
To backtest a cTrader cBot, first make sure you have the cTrader Algo application open and add a new instance for your cBot from the list, and choose your symbol. Choose the backtesting option by clicking on the Backtesting tab at the top of the screen.
Once you have the backtest tab open, you need to configure your backtest settings such as the spread, commission, and starting account balance. These should match the conditions of your intended trading environment. You will also need to set the backtest start and end dates, once this is done you are ready to start your backtest. cTrader will simulate how the cBot would have traded based on the historical data.
The window at the bottom is called the trade watch panel and this has some useful information about the backtest results
- Equity, displays an equity graph with the equity growth vs drawdown.
- Trade Statistics, displays an equity graph with the equity growth vs drawdown.
- Positions, displays any positions that are currently open.
- Orders, displays any positions that are currently open.
- History, shows history of all trades that opened and closed.
- Events, displays all the positions and orders execution events.
- Logs, this is very useful for identifying any errors with trade execution and events for the trading system.
Parameter Settings
It is very important that you use the correct parameter settings for the cBot when running a backtest, if you have just run an optimisation of parameters, make sure you apply and save this settings for future use.
Backtest Settings
It is very important that you configure the backtest settings correctly, it needs to match your realtime trading enviroment, one of the most important settings is the data, for a quick backtest to check your cBot settings use 1-min bar with a fixed spread, and once you are happy test with tick data.
TICK DATA vs 1-MIN BAR
Tick data includes the symbol's historical spread, and the 1-min bar allows you to use a fixed spread; if you set this setting wrong, your results will not reflect an actual historical test. You may ask by bothering with a 1-min bar if it uses a constant fixed spread. This is very useful for a quick backtest, but we recommend that you always use the tick data option for a more accurate backtest.
Video Tutorial
Watch a video tutorial on how to backtest a cTrader cBot. The video is a little old, but still valid today.
It will visualize how the price moved for the historical data, this allows you to see how the market played out so you can make adjustments to your strategies, the image image shows one of our Risk & Reward Tool being used to setup trades with calculated risk and manually submit the orders.
Discrepancies
There are a few common issues when you run a backtest and the results do not match the live trading that happened in the past, these can be caused by the following conditions.
- Not using Tick Data in the backtest settings.
- The start and end dates are not the same as your live test.
- You have not set the correct commission value for non-Forex.
- Your cBot settings for the backtest do not match your live trading settings.
Market Dynamics
Backtest data often differs from live trading data due to several factors that affect the simulation's accuracy compared to real market conditions. Backtests rely on historical data, which may not capture real-time market fluctuations such as sudden news events, liquidity gaps, or volatile price spikes that can occur during live trading.
Slippage
In live trading, the trades may be executed at different prices due to market liquidity, which is not always fully accounted for in backtesting.
Spreads
Backtests with 1-min bar data use fixed spreads, but in live trading, spreads can widen during high volatility or low liquidity periods, affecting trade outcomes. It is always best to use tick data.
Latency
Live trading involves network latency, which can impact entry and exit points. Backtests assume instant execution, which isn't always realistic.
Commission and Fees
While backtesting allows you to set fixed commission and fee's, the actual costs can vary depending on the broker, trade volume, or account type.
Data Quality
The quality of the historical data used in backtesting can differ from the data received during live trading. Inaccuracies, missing data, or lack of tick-level details can lead to discrepancies.
PLATFORM LIMITATIONS
Even if you run the backtest from one date to another, you may still not see the same results, even 1-hour can make a difference between a trade opeening and running preventing other trades from opening and all future trades being out of sync. This can happen due to the strategies trade rules.