In the event of a stochastc going below a certain level eg 20, I need to check whether this is first such occurence since the 20ma crossed the 80ma from below.
Many thanks.
Is anyone able to help please?
Hi! here you have.
sma80=average[80](close)
sma20=average[20](close)
stok=Stochastic[14,3](close)
if sma20>sma80 then
cross=cross+(stok crosses under 20)
else
cross=0
endif
SCREENER[cross=1 and cross<>cross[1]]
You can change cross=1 for cross=3 if you want the third cross.
Thanks Ivan, I have complete a quick test and don’t think it is quite correct.
As you can see in the attached image the cross over occurs at point 1, in this case I am only interested in the first occassion following the crossover that stoch is below 20. Don’t wish to be notified of subsequent instances where stoch crosses below 20 (ie point 3/4)
JSParticipant
Senior
Try this one…
SMA20=Average[20](Close)
SMA80=Average[80](Close)
Stoch=Stochastic[14,3](Close)
SMABars=BarsSince(SMA20 crosses over SMA80)
SMABars=Max(SMABars,1)
Signal=Summation[SMABars](Stoch crosses under 20)=1
Screener[Signal](Stoch as "Stoch")