Backtesting a cBot on the cAlgo Platform
Hello, Traders! Welcome to the cTrader Tutorial and the Fifth Module: Extras.
In this lesson, we’re going to learn how to backtest a cBot on the cAlgo Platform. As you already know, we downloaded the Zephyn Scalper II cBot or robot, and we want to back test it on the one-minute chart. Now, to do so, what we’re going to do is we’re going to add the Euro-U.S. dollar to the Zephyn Scalper II robot and we are going to get the chart. Then we are going to go and click the Backtesting tab. Now, cTrader has a very powerful backtesting system, and I’m going to teach you how to use it.
Now, the first thing you want to do is you want to choose the time frame or how many days you want to test the robot on. Since this is just a demonstration, we are going to test it on about 25 days. From today until October the first, well which is about 11 days. No, about a month so this is fine. Then we’re going to go to the wheel. When you click in this wheel, you are going to choose the starting capital for the backtest. Remember that when choosing the starting capital for the backtest, will only affect the actual backtesting capital not your actual capital on your live account.
So we’re going to start with $10,000 and you have to choose the commissions per million traded, per million units traded. So we are going to choose a commission per million traded of 30. Then you have to choose the data. We always want to use the tick data because it’s more accurate than the one-minute bar data. And once you chose the data and everything is done, you click on Start and you wait for the backtest to end.
But if you choose to use the one-minute bars from server, you are going to have to choose the spread. And you can choose a fixed spread of one pip. Well, you can choose from 0 pips to 30 pips. Of course, if you choose a fixed spread, you can choose a 0.8 pip spread for the Euro-U.S. dollar which is fine or a random spread from 0.5 to 0 pips. And this is what we are going to be choosing actually, a random spread for this backtesting. And then you click on Play, which will play the backtest on the robot on the Euro-U.S. dollar one-minute chart.
Now, remember that we started with $10,000 and here we are going to be trading one lot with a stop-loss of 5 pips which is fine for the risk profile that we want to be trading in. So we click Play and we wait for the backtest to end. Okay so the backtesting ended here on the Euro-U.S dollar one hour chart for 40 days and the robot lost 12% of the account or £1,164. Right here you can see that the robot put on a buy Trade, which got stopped out of course because price continued to move down. The cool thing about the backtest is that you could see for how long this trade was open.
Now if you look closely here, the risk profile that we chose is actually not very accurate because this buy trade was open for quite a while but the thing that we are more interested in is this, the events. When you click on the Events tab, you can see what the actual orders were. And right here, you can see that the bot created a position, then modified the same position, which was a buy, and the position was modified a lot actually.
And right here, when the event is position modified, it means that the stop-loss got trailed and right here the stop-loss got hit. And if you look closely, when the position started, the balance of the account was $10,000. And when the position closed, we had a balance of $10,158. So this first trade made a $158. The second trade lost about $300, and the third trade, you can see that was a buy position and then the stop got trailed and it got hit. Well, we just need to go down to see when the stop got hit on this second Trade right here. The stop got hit right here and the position made about $600 and etc. This is how you are going to be reading the events okay.
Now, this is the Equity and Balance Chart and then you can see that overall, the robot lost money starting with $10,000 and we made money, lost money. And then at the end of the backtest, the robot just couldn’t stop losing money. Now the statistics, if you look at this statistics, the net profit of the robot was $1,164, the commissions were $75, the maximum drawdown was 15%, which is big, on the balance and 22% on the equity. Just by looking at these statistics, this robot does not work on the one-minute chart on the Euro-U.S. dollar, for example.
The largest winning trade was $616 and the largest losing trade was $353. Now, this is very good because actually we have a…well, the biggest winning trade doubled the largest losing trade, which means that the risk to reward ratio on this robot is there, but the performance is just not. And then you can look at the history, which are all the trades that the Zephyn Scalper II made and the log.
And this is basically how you are going to be backtesting a robot and if you are not comfortable with the performance of the one-minute chart, you can go ahead and look at the five-minute chart and look at the performance of the five-minute chart. And, of course, you can change all of the rules of the robot right here.