SMA50 is above SMA200 but for less than 3 weeks
Forums › ProRealTime English forum › ProScreener support › SMA50 is above SMA200 but for less than 3 weeks
- This topic has 3 replies, 2 voices, and was last updated 2 years ago by
JS.
-
-
07/15/2023 at 3:08 PM #217696
Hi,
here is my code :
1234567TIMEFRAME(daily)SMA50 = average[50](close)SMA200 = average[200](close)c1 = SMA50 > SMA200SCREENER [c1]How would you do to only report stocks for which the SMA50 is above SMA200 but for less than 3 weeks ? the idea is to get stocks that recently started to go up
another question but related to the 1st one :
today is July 15th. To get the average between July 1st and July 15th, I would do that : average[15](close). Now, if I want the average between July 1st and July 10th, how should I do ?regards
07/15/2023 at 4:16 PM #217704Hi,
You can always use the “Summation” function…
C2=Summation[15](SMA50>SMA200)=15
What it says here is: count the days over the last 15 days where the SMA50 is above the SMA200 and this number of days must be equal to 15.
The number of (trading) days between the 1st and the 15th of July is equal to 10, so Average[10](Close)…
The number of (trading) days between the 1st and the 10th of July is equal to 5 or 6 so Average[5](Close)…
07/15/2023 at 4:53 PM #21770507/15/2023 at 6:52 PM #217706Hi,
That’s right, that wasn’t foolproof…
You can add an extra condition that calculates the day of the crossing between SMA50 & SMA200…
SMA50 & SMA200 Calculations1234567891011121314151617TIMEFRAME(daily)SMA50 = average[50](close)SMA200 = average[200](close)C1=Summation[15](SMA50>SMA200)=15N=50For i=0 to N-1If SMA50[i]<SMA200[i] thenCrossing=iBreakEndIfNextC2=Crossing>15 and Crossing<20Screener[C1 and C2](Crossing as "DaysBackCrossing")1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on 