Hi,
How do I test whether, as an example, 5 out of the last 7 candles were red (in a downtrend) . Any green candles can be ignored unless they break the previous high.
Opposite for uptrend.
WingParticipant
Veteran
In a downtrend, something like this:
FiveSevenRed=0
RedCandles=0
FOR i = 0 TO 6 DO
IF (Close[i] < Open[i]) THEN
RedCandles=RedCandles+1
ELSE if close>high[i+1] then
Break
ENDIF
FiveSevenRed=1
NEXT
If RedCandles<5 then
FiveSevenRed=0
Endif