counts the number of times in a row the high is greater than the previous high, or the low is lower than the previous low. reset every time this rule was breached.
+ the average of the past x periods.
AVPeriod = 20
IF High >= High[1] THEN
CHigh=CHigh+1
ELSE
CHigh=0
ENDIF
IF low <= low[1] THEN
Clow=Clow+1
ELSE
Clow=0
ENDIF
CAvHigh = Average[AVPeriod](CHigh)
CAvLow = Average[AVPeriod](CLow)
RETURN CHigh COLOURED (220,100,100) AS"CHigh", Clow COLOURED (80,210,80) AS"CLow", CAvHigh AS"Average High", CAvLow AS"Average Low"