get the SMA200 value of 20 days ago
Forums › ProRealTime English forum › ProScreener support › get the SMA200 value of 20 days ago
- This topic has 7 replies, 2 voices, and was last updated 1 year ago by robertogozzi.
-
-
10/02/2023 at 2:39 PM #22194810/02/2023 at 3:40 PM #221950
There you go:
123Sma200 = average[200,0](close)UP = Sma200 > Sma200[20]SCREENER[UP](Sma200 AS "Sma200")10/02/2023 at 8:45 PM #221962I’m confused…
here is my original screener :
123456789101112131415161718192021222324252627282930TIMEFRAME(daily)SMA50 = average[50](close)SMA200 = average[200](close)NoDaysMaxForCrossing = 20xCrossing=0For i=1 to NoDaysMaxForCrossingIf SMA50[i] crosses over SMA200[i] thenxCrossing=iBreakEndIfNextC1=xCrossing>=1 and xCrossing<=NoDaysMaxForCrossingSMA5enBaisse = close[5] > close[3] AND close[3] > closePrixAuDessusSMAs = close > SMA200 AND close > SMA50// DEFAULT CONDITIONSTimeframe(Yearly)minimumAge = barindex>=3TimeFrame(Monthly)p1 = lowest[36](close)>=3TimeFrame(Daily)p2 = (close<= 1000)v1 = Average[50](Volume) >= 50000defaultConditons = p1 AND p2 AND v1 and minimumAge// DEFAULT CONDITIONSScreener[C1 and SMA5enBaisse and PrixAuDessusSMAs and defaultConditons](xCrossing as "DaysBackCrossing")If I run this screener on the “US NSYE Actions”, it returns 8 stocks including the one on the screenshot. On this screenshot, we can see that the SMA200 100 days ago was below today’s SMA.
But if I add a new criteria based on what you told me, I get 0 result. I don’t get. What did I do wrong ? any idea ?123456789101112131415161718192021222324252627282930313233TIMEFRAME(daily)SMA50 = average[50](close)SMA200 = average[200](close)NoDaysMaxForCrossing = 20xCrossing=0For i=1 to NoDaysMaxForCrossingIf SMA50[i] crosses over SMA200[i] thenxCrossing=iBreakEndIfNextC1=xCrossing>=1 and xCrossing<=NoDaysMaxForCrossingSMA5enBaisse = close[5] > close[3] AND close[3] > closePrixAuDessusSMAs = close > SMA200 AND close > SMA50SMA200goingUp = SMA200 > SMA200[100]// DEFAULT CONDITIONSTimeframe(Yearly)minimumAge = barindex>=3TimeFrame(Monthly)p1 = lowest[36](close)>=3TimeFrame(Daily)p2 = (close<= 1000)v1 = Average[50](Volume) >= 50000defaultConditons = p1 AND p2 AND v1 and minimumAge// DEFAULT CONDITIONSScreener[C1 and SMA5enBaisse and PrixAuDessusSMAs and SMA200goingUp and defaultConditons](xCrossing as "DaysBackCrossing")10/03/2023 at 4:31 AM #221967SMA200goingUp = SMA200 > SMA200[100] is not allowed in screeners as 200+100 exceeds the 256-bar limit with IG. Only the premium version from PRT supports a 1024-bar limit.
To make sure your conditions are all correct, analyze them separately, esch one of them, then combine them.
10/03/2023 at 5:42 AM #22196810/03/2023 at 9:33 AM #221981All you need is to use test one condition at a time:
- Screener[C1]
- Screener[SMA5enBaisse]
- Screener[PrixAuDessusSMAs]
- Screener[SMA200goingUp]
- Screener[defaultConditons]
when you are confident they all work, you can combine them in a single line.
10/03/2023 at 6:13 PM #22200610/03/2023 at 6:54 PM #222008One condition at a time like my example in my last post.
You start with the first one, when it’s ok thrn you replace it with the second one (or even better, you add it to the first one), eyc… until all conditions return what you expect.
Then you may combine them as you want, like you did in line 30 or 33.
-
AuthorPosts