I want to exit from buy will be when candle closes below the
lows of previous 9 candles with closing price below 8 EMA and exit from
sell will be when candle closes above highes of previous 9 candles with
closing price below 8 EMA.
BUY EXIT:
CLOSE <REF(lowestlowvalue(9),1) AND CLOSE < EMA (CLOSE,8)
SELL EXIT:
CLOSE > Ref(highesthighvalue(9),1) AND CLOSE < EMA (CLOSE,8)