I need to tweak my indicator that identifies demand zones on a chart.
The pattern it needs to look for is:
A red leg
candle...
Followed by up to 1-4 consecutive base
candles...(color doesn't matter)
Followed by up to 1-4 green leg
candles...
Followed by a base candle (color doesn't matter)
Leg candle=Body of candle is >= 50% of the whole candle
Base candle=Body of candle is < 50% of the whole candle
The current code I have only finds a pattern of Red leg candle, base candle, green leg candle, base candle.
I need it to be able to allow for 1 to 4 base candles after the first candle, and then 1 to 4 green leg candles after the base candle(s).
How do I write a condition that the pattern can have 1 to 4 consecutive base candles, but not more than 4?