Hello and good afternoon.
I wonder if someone here is able to help me please.
What I would like to screen where:
50 period MA has turned positive within the past n periods (variable but defaulted to 26), record in variable x how many periods ago the trend changed.
AND
Stochastic (12,2,2) for the current period is below 30. However this must be the first time this has breached this level during the past x periods.
Many thanks in advance.
I hope this makes sense?
Regards
Simon
Anyone able to help please 🙂
Hi,
To be tested:
N=26
ma50=Average[50](close)
sto=Stochastic[12,2](close)
dir=sgn(ma50-ma50[1])
if dir>0 and dir[1]<0 then
mark=barindex
endif
x=barindex-mark
c1= x<=N and dir>0
c2= sto<30 and summation[X+1](sto crosses under 30)=1
screener[c1 and c2]
Thank you so much, I will take a look.
Hi sorry I went back to this and realised that I need to also check whether during the same look back period (26) whether the the Upper bollinger band was crossed. And Finally check the current close market price is at least 10% lower than the high within the look back period.
Many thanks in advance.
Hi, the 2 conditions are added in c3 and c4 :
N=26
ma50=Average[50](close)
sto=Stochastic[12,2](close)
dir=sgn(ma50-ma50[1])
if dir>0 and dir[1]<0 then
mark=barindex
endif
x=barindex-mark
c1= x<=N and dir>0
c2= sto<30 and summation[X+1](sto crosses under 30)=1
c3= summation[N](close crosses over BollingerUp[20](close))>=1
c4= close<=0.9*highest[26](high)
screener[c1 and c2 and c3 and c4]