Hidden trap of doing backtest in batches

I will explain the trap using example. Let’s see the following chart. Assuming the strategy will only exit on profit, if you backtest on full timerange, you will get 1 trade only, and that trade is force exited.

Backtest on full timerange

Now let’s see what happen if I split the backtest into 2. The initial trade entry remain the same. At the end of first timerange, the trade will be force exited. Then we move to second backtest. In the second backtest, you will get 2 profitable trades. In total, you have 3 trades and get smaller total loss than if you backtest on full timerange.

Backtest split into 2

Let’s see what happen if we split the backtest to 3. Now you get 5 total trades and you are on a small profit.

Backtest split into 3

So which one is correct behavior? Of course the one backtested on full timerange without being split. Splitting the backtest into several batches will skew the result and will give you wrong total strategy performance. Can you avoid such issue while still doing backtest in batches? Sure, if your average trade duration is very short. To know whether there is any issue with your batches of backtest or not, check the exit reason for each batch. Except for the last batch, all other batches shouldn’t have any force exit.

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *