AlfyParticipant
Average
Good morning, once again thanks for your help with this. I used the exact code you helped me with (attached) but it doesn’t seem to work properly. i tested it on the ETF PHSP (LSE) and the indicator should have picked up that yesterday was an “up day” with volume greater than the previous 10 “down days” but sadly it didn’t. Yesterday was an up day (close higher than previous close) and volume of 72k when the highest volume of the last 10 down days was around 45.8k. Could you see where its going wrong please?
Thanks in advance and sorry for the trouble.
maxDay = 10
maxDownDayVol = 0
count = 0
if barindex >= maxday then
FOR d = 1 TO barindex DO
IF Close[d] < open[d] THEN
count = count + 1
maxDownDayVol = max(volume[d],maxdowndayvol)
if count = 10 then
break
endif
ENDIF
NEXT
ind1 = (volume > maxDownDayvol) and (close > open)
endif
RETURN ind1 COLOURED (0,0,200) AS "Pivot Pocket"
I don’t see 10 red candles with lower volume. I see the fourth red candle before having much bigger volume.
The indicator seems to be working just fine.
AlfyParticipant
Average
Good morning, thanks for your last reply. I have one simple qstion regarding the original code i queried about if you dont mind which ive copied in this message. The code counts as an up day “close>open” and a down day as “close d – open d.” Can you tell me how to change the code so that a down day is considered as close < close of the previous day rather than close versus open?
Thanks for your patience
daystoconfirmuptrend = 50
cPrc1 = (close > Average[daysToConfirmUpTrend](close) AND Close > open)
maxDay = 10
maxDownDay = 0
maxdown = 0
FOR d = 1 TO maxDay DO
r = Close[d] - open[d]
IF r <0 and volume[d]> maxDown THEN
maxDown = volume[d]
maxDownDay = d
ENDIF
NEXT
IF maxDownday = 0 THEN
maxDowndayVol=0
ELSE
maxDowndayvol = volume[maxdownday]
ENDIF
cVol2 = (volume > maxDownDayvol)
Cprc2 = (close >= Average[20](close))
Cprc3 = (close CROSSES OVER Average[10](close) OR Close CROSSES OVER Average[50](close))
cPrc11 = (close > (high + low) *0.5)
Cprc13 = (close[1] < highest[65](close))
ind1 = (cPrc1 AND cPrc2 AND (cPrc3 OR 1) AND cVol2 AND (cPrc11 OR 1) AND (cPrc13 OR 1))
RETURN ind1 COLOURED (0,0,200) AS "Pivot Pocket"