Good morning, hoping someone is able to assist.
As per the title I am looking to screen for stocks which have a stochastic value of less than 25 however I only wish to that those examples where this is the first time we have seen such a value since the 50 period ma crossed (from below) the 80 period ma. Hope this makes sense. Example attached.
Many thanks in advance.
Here you have:
stoK=Stochastic[14,3](close)
sma50=average[50](close)
sma80=average[80](close)
if sma50 crosses over sma80 then
flag=1
elsif sma50 < sma80 then
flag=-1
endif
if flag=1 and stoK crosses under 25 then
flag=0
endif
screener[flag=0 and flag[1]=1]