I tried this code (results are in comments).
|
//DEFPARAM PreLoadBars = 0 //starts from 1000 (default value) //DEFPARAM PreLoadBars = 500 //starts from 500 //DEFPARAM PreLoadBars = 5000 //starts from 5000 //DEFPARAM PreLoadBars = 10000 //starts from 10000 //DEFPARAM PreLoadBars = 11000 //starts from 10000 (any value > 10000 will be ignored) ONCE TradeON = 1 SELL AT Market IF IsLastBarUpdate AND Not OnMarket AND TradeON THEN BUY at Market TradeON = 0 ENDIF graph BarIndex |
The count is checked on the setup bar (the one BEFORE the arrow plotted by ProBackTest, the bar when the BUY order is placed).