Hi,
here is my screener :
TIMEFRAME(daily)
SMA50 = average[50](close)
SMA200 = average[200](close)
C1=SMA50>SMA200
Crossing=1000
N=50
For i=0 to N-1
If SMA50[i]<SMA200[i] then
Crossing=i
Break
EndIf
Next
// i want SMA50 above SMA200in the last 5 days
C2=Crossing<5
Screener[C1 and C2](Crossing as "DaysBackCrossing")
Basically, I want to get the stocks whose SMA50 went above SMA200 in the last 5 days.
Most of my results are correct, but for some, i notice the SMA50 being below SMA200. Any idea why ? I’ll attach 2 screenshots for the same stock that was reported by the screener. one screenshot has historical data adjusted for dividends, and the other without the adjustment. In both cases, SMA200 is above SMA50.
thanks
This will do:
TIMEFRAME(daily)
SMA50 = average[50](close)
SMA200 = average[200](close)
c1 = Sma50[5] < Sma200[5]
c2 = (summation[5](Sma50 > Sma200) = 5)
Screener[C1 and C2]
hi,
it seems that this script returns the stocks where SMA50 went above SMA200 5 days ago, and not in the last 5 days, doesn’t it ?
and this script returns 4 results on the NYSE. I’m attaching one of the 4 results where SMA50 is below SAM200. So it also seems to be doing the same weird thing as my original script. any idea why ?
JSParticipant
Veteran
Hi,
Try this one:
TIMEFRAME(daily)
SMA50 = average[50](close)
SMA200 = average[200](close)
xCrossing=0
For i=1 to 5
If SMA50[i] crosses over SMA200[i] then
xCrossing=i
Break
EndIf
Next
C1=xCrossing=1 or xCrossing=2 or xCrossing=3 or xCrossing=4 or xCrossing=5
Screener[C1](xCrossing as "DaysBackCrossing")
No, my script checks only the last 5 bars, the 6th bar, bar 5, is checked not to be above.’