Can you Code on previous day candle range

Code the below condition

Buy LTP > previous day high and previous candle range(difference between High and Low) should be narrowest of any of the past 6 candles(range of each candle may or may not be continuous).

Sell LTP < previous day low and previous candle range(difference between High and Low) should be narrowest of any of the past 6 candles(range of each candle may or may not be continuous).

1 Like

 Buy:  

LAST > REF(HIGH,1) AND (HIGH - LOW) < (REF (HIGH, 1) - REF (LOW, 1)) AND (HIGH - LOW) < (REF (HIGH, 2) - REF (LOW, 2)) AND (HIGH - LOW) < (REF (HIGH, 3) - REF (LOW, 3)) AND (HIGH - LOW) < (REF (HIGH, 4) - REF (LOW, 4)) AND (HIGH - LOW) < (REF (HIGH, 5) - REF (LOW, 5)) AND (HIGH - LOW) < (REF (HIGH, 6) - REF (LOW, 6))

Sell: 

LAST < REF(LOW,1) AND (HIGH - LOW) < (REF (HIGH, 1) - REF (LOW, 1)) AND (HIGH - LOW) < (REF (HIGH, 2) - REF (LOW, 2)) AND (HIGH - LOW) < (REF (HIGH, 3) - REF (LOW, 3)) AND (HIGH - LOW) < (REF (HIGH, 4) - REF (LOW, 4)) AND (HIGH - LOW) < (REF (HIGH, 5) - REF (LOW, 5)) AND (HIGH - LOW) < (REF (HIGH, 6) - REF (LOW, 6))
1 Like