I’d like to know how to write a code which allow to check if current candle has a larger body than previous n candles or not. This checking keep repeating when next candle starts.
That code can also be adapted easily to look for the largest range in n candles.
1
2
3
4
5
6
Numcandles=20
Rnge=abs(High-Low)
LargestRange=(Rnge=highest[NumCandles](Rnge))
RETURNLargestRange
and also sometimes it is interesting to know when a candle has the smallest body or range in n candles. Quite useful to get out of the market with your profit when the market has gone a bit flat.