I was trying to backtest a breakout strategy.
The problem is when the longCondition
is met, buystop is triggered. But this buy order if not fulfilled in the next candle looks for signals in the following candles. How to stop looking for fulfillment once it is not met in next candle? I tried using strategy. Cancel but it could not cancel the order fulfillment if not fulfilled in the next candle.
hh = highest(high,13)
longCondition=close >= hh[1]
if (longCondition)
StopPrice= high+syminfo.mintick
LimitPrice= StopPrice+(4*syminfo.mintick)
strategy.entry("13 days breakout",long=true, stop=StopPrice, limit= LimitPrice)