5 min EMA AND daily pivot points : distance from price
Forums › ProRealTime English forum › ProScreener support › 5 min EMA AND daily pivot points : distance from price
- This topic has 12 replies, 3 voices, and was last updated 5 years ago by Sébi.
-
-
02/07/2019 at 7:50 AM #90670
Hello,
Is it possible to screen at the same time the markets that meet the following conditions : the distance between the actual price and the closest daily pivot point AND the distance between the actual price and the 5 min EMA [21] is inferior to a certain number?
I could make the program for both and it works, but when I mix them in a single program, either it will show the conditions for a 5 min timeframe (the pivot points are no more the daily ones) or for a daily timeframe (the EMA is no more a 5 min EMA).
I fail to understand (I am a beginner with ProScreener) why when I launch the program with the option “5 min timeframe” the daily pivot points are no more the daily ones. Here is the beginning of the program for the calculation of the pivot points. The instructions DHigh(1), Dlow(1) and DClose(1) should refer to the previous day, not to the previous candle, shouldn’t it?
Ht = DHigh(1)
L = DLow(1)
C = DClose(1)Pt = (Ht + L + C) / 3
Re4 = Pt + ((Ht – L)*3)
Re3 = Pt + ((Ht – L)*2)
Re2 = Pt + Ht – L
Re1 = (2 * Pt) – L
Su1 = (2 * Pt) – Ht
Su2 = Pt – (Ht – L)
Su3 = Pt – ((Ht – L)*2)
Su4 = Pt – ((Ht – L)*3)
mRe1 = (Pt + Re1) / 2
mSu1 = (Pt + Su1) / 2
mRe2 = (Re1 + Re2) / 2
mSu2 = (Su1 + Su2) / 202/07/2019 at 9:52 AM #90686Your assumption is right, this code should work on any other timeframe than the daily one and return the correct daily pivot points. On what instrument did you made your tests?
With this code, on a 5-minute TF, the right pivot point value is correctly returned:
1234567Ht = DHigh(1)L = DLow(1)C = DClose(1)Pt = (Ht + L + C) / 3screener(pt)02/11/2019 at 4:06 AM #91002Thank you Nicolas.
It does not give me the proper pivot points when I select “5 minutes” as a time frame for currencies (I need to select “journalier” for getting the correct ones). Surprisingly, it gives the correct pivot points for the indices in any timeframe selected. Any idea why it is so?
02/12/2019 at 1:47 AM #9111402/12/2019 at 9:02 AM #91123Replace line 7 with:
1screener[pt]02/12/2019 at 10:51 AM #91149Thanks for your reply Roberto.
Below is what I wrote :
It shows the markets which price is near EMA21 or any Pivot point. My lonely problem is that the pivot points are not what they suppose to be when I choose to screen with a 5min TimeFrame or less.1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465Ht = DHigh(1)L = DLow(1)C = DClose(1)Pt = (Ht + L + C) / 3Re4 = Pt + ((Ht - L)*3)Re3 = Pt + ((Ht - L)*2)Re2 = Pt + Ht - LRe1 = (2 * Pt) - LSu1 = (2 * Pt) - HtSu2 = Pt - (Ht - L)Su3 = Pt - ((Ht - L)*2)Su4 = Pt - ((Ht - L)*3)mRe1 = (Pt + Re1) / 2mSu1 = (Pt + Su1) / 2mRe2 = (Re1 + Re2) / 2mSu2 = (Su1 + Su2) / 2ema = ExponentialAverage[21]price = closecema = abs(ema-price)cp = abs(Pt-price)cr1 = abs(Re1-price)cr2 = abs(Re2-price)cr3 = abs(Re3-price)cr4 = abs(Re4-price)cs1 = abs(Su1-price)cs2 = abs(Su2-price)cs3 = abs(Su3-price)cs4 = abs(Su4-price)cmr1 = abs(mRe1-price)cmr2 = abs(mRe2-price)cmS1 = abs(mSu1-price)cmS2 = abs(mSu2-price)If price < 90 then// conditions pour le forexif cema<0.0005 thencriteria = ROUND(cema*10000)elsif cp<0.0005 OR cr1<0.0005 OR cr2<0.0005 OR cr3<0.0005 OR cr4<0.0005 OR cs1<0.0005 OR cs2<0.0005 OR cs3<0.0005 OR cs4<0.0005 OR cmr1<0.0005 OR cmr2<0.0005 OR cmS1<0.0005 OR cmS2<0.0005 thencriteria = PtendifFilter1 = cema<0.0006 OR cp<0.0005 OR cr1<0.0005 OR cr2<0.0005 OR cr3<0.0005 OR cr4<0.0005 OR cs1<0.0005 OR cs2<0.0005 OR cs3<0.0005 OR cs4<0.0005 OR cmr1<0.0005 OR cmr2<0.0005 OR cmS1<0.0005 OR cmS2<0.0005elsif price > 1000 then// conditions pour les indicesif cema<6 thencriteria = ROUND(cema)elsif cp<6 OR cr1<6 OR cr2<6 OR cr3<6 OR cr4<6 OR cs1<6 OR cs2<6 OR cs3<6 OR cs4<6 OR cmr1<6 OR cmr2<6 OR cms1<6 OR cms2<6 thencriteria = PtendifFilter2 = cema<6 OR cp<6 OR cr1<6 OR cr2<6 OR cr3<6 OR cr4<6 OR cs1<6 OR cs2<6 OR cs3<6 OR cs4<6 OR cmr1<6 OR cmr2<6 OR cms1<6 OR cms2<6endifFilter = Filter1 OR Filter2SCREENER [Filter](criteria)02/12/2019 at 11:01 AM #91156To write code, please use the <> “insert PRT code” button, to make code easier to read (I tided it up for you). Thank you.
1 user thanked author for this post.
02/12/2019 at 1:11 PM #91180It’s normal since ProScreener has a limitation of 254 bars. If you want to know the pivot points from yesterday, use the TIMEFRAME instruction.
Replace line 7 with:
It was not the purpose of the code to screen a condition 🙂
2 users thanked author for this post.
02/12/2019 at 5:31 PM #9120802/12/2019 at 6:22 PM #91216A short template on how-to with the TIMEFRAME instruction:
123456789101112131415161718192021TIMEFRAME(daily)Ht = High[1]L = Low[1]C = Close[1]Pt = (Ht + L + C) / 3Re4 = Pt + ((Ht - L)*3)Re3 = Pt + ((Ht - L)*2)Re2 = Pt + Ht - LRe1 = (2 * Pt) - LSu1 = (2 * Pt) - HtSu2 = Pt - (Ht - L)Su3 = Pt - ((Ht - L)*2)Su4 = Pt - ((Ht - L)*3)mRe1 = (Pt + Re1) / 2mSu1 = (Pt + Su1) / 2mRe2 = (Re1 + Re2) / 2mSu2 = (Su1 + Su2) / 2TIMEFRAME(default)//put here the rest of the code ...02/13/2019 at 7:35 AM #9124802/13/2019 at 3:01 PM #9129802/15/2019 at 2:00 AM #91430 -
AuthorPosts
Find exclusive trading pro-tools on