Exrem does not trigger first buy signal

Exrem is used to remove excess signals, however, i have noticed that this can potentially miss the first buy signal when backtesting. This is because a buy will only be triggered after a sell, and vise versa.

So lets say i am backtesting a specific timeframe.
Even though a buy signal criteria is met, it will only buy if the preceding signal (before the backtesting start date) was a sell. If the preceding signal is a buy, the new buy will not be triggered.

Has anyone else come across this and know of a smart way to code around this issue?

Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);

Just add this to your Buy logic:
AND Status("BarInRange")

Now you will not generate Buy signals that occur outside the date range of your back test.

5 Likes

mradtke == legend

:slight_smile:

1 Like