Backtest or Fail

AriaS

Well-known member
Messages
271
Likes
106
Why there is no profitable trading or investing without backtesting:
because all our decisions are always based on the past, since the past is the only thing we have access to. There’s no way to know whether a trading strategy will work in the future, without checking if it worked in the past.


How do we know how to backtest correctly and if our backtests work:



  1. Correct backtesting: first and foremost, we must make sure our backtesting conditions are as close as possible to real time trading. For example, no point to backtest a scalping or rollover strategy in MT4 or on OHLC modelling in MT5, because we need the real spread of each tick. Also, if our strategy enters or exits during the news then it is prone to slippage. Backtests will only be approximate at best, and you will have to research the slippage in real time and then take it into account in your backtesting. Swing strategy can be well tested on OHLC modelling, but MT4 is still not a good place to start. I came across completely different results on MT4 vs MT5, while only the results of the latter matched live trading well.
  2. How do we know if our backtesting algorithm works: we forward test. You don’t simply backtest on the last several months and go on live account. You backtests on lots of periods in the past and then check the chosen setup on a period that follows. This way you can make sure that your backtesting algorithm works.

As an example, here is my backtesting algorithm (for my forex strategy):


My strategy has several custom made indicators. Each of them has several parameters, so when you add the basic trading settings like stops, trading direction etc, the number of variants in optimization can reach millions.


Basic info: Swing, 27 pairs, MT5

  1. Once per month, or more often, I optimize each pair, 3 months back, by recovery factor. The optimization offers 2.5 million variants, but in fact I stop it at 1-2k when I see around 10-20 variants above RF = 2, that have more than X trades, for some statistical representativeness.
  2. My strategy is aiming at universal principles, so that it works better on any curve, but random curve fits still happen. This means they succeeded not due to universality, but due to randomness. One of the reasons this happens: lack of parameter dependency support in MT5 backtester - it tests every possible combination. To filter out the random variants of the chosen 10-20, I perform 2 steps. I will share one of them:

a. I run the 10-20 variants on a different curve. Usually, it’s the 3 months prior to the optimization period, but also it might be some other periods of the past. Eventually, for the next month of my live trading I choose the variant with the highest recovery factor, that has more than X trades.
 
Last edited:
Back
Top