like this the correct/best way to do it?
MFE = MAX(1,summation[barindex-tradeindex](positionperf > 0))
IF shortonmarket and barindex-tradeindex > 24 and MFE <= 6 then
Exitshort at market
Buy 5 perpoint at market
endif
To add…. Im not sure it is anything to do with the entry/exit as the error happens on the 3rd bar. so no where near when it should be reversing.
ive attached the screenshots of when it quit – 0920
also current MFE value is 1
current positionperf is -0.00119
any ideas appreciated as this change is a +25% increase to algo. again no issues in backtest, just on Live, IG, DAX 1MIN DFB
Try add check that barindex – tradeindex > 0
Back test not reliable on this matter as it cannot detect division by zero so I’m not surprise if it cannot detect summation with negative value too
Thanks DJ, i’ll try that.