We are often asked about "bugged" backtests that are not executing orders, especially trailing stops and taking profits. The backtest below is such an example, where the exit condition is set to take a profit of 4%, but the last candle has a -49.03% return.

How is that possible? Is that a bug? The short answer is - No, that is just an unrealized P/L. If you want to learn more, continue reading.

As we can see below, the last hit was an entry. That means that a position has been opened, but hasn't been closed:

The immediate conclusion is that the loss of this trade or candle is unrealized. The position is still open, therefore no actual loss should be noted or calculated.

There are 2 more clues that can hint at unrealized P/L:

Red - the last hit is hit number 8. We can see at the top of the screen that there are indeed 8 hits. However, when looking at the bottom hits summary, we see that only 7 hits (the closed positions) are calculated in the strategy performance.

Yellow - the backtest summary shows 100% winning, which is not settling with the last candle. this too can suggest that the last candle is an unrealized P/L and that the position remained open.

So, the next time you see a significant loss at the last candle of the backtest - don't worry, it is just an open position that hasn't met the exit conditions, resulting in an unrealized P/L.

Did this answer your question?