# 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 contains 12 replies, has 3 voices, and was last updated by  SebiJi 2 months, 1 week ago.

View all attachments
Viewing 13 posts - 1 through 13 (of 13 total)
• #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) / 2

#90686

Your 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:

#91002

Thank 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?

###### Attachments:
#91114

The problem happens only with 5 min time frame and less (smaller the time frame, bigger the difference with the daily pivot points). With 10 min and higher time frame, the pivot points are correct and the same. Strange indeed.

#91123

Replace line 7 with:

#91149

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.

#91156

To 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.
#91180

It’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.
#91208

The TIMEFRAME instruction does not help.

#91216

A short template on how-to with the TIMEFRAME instruction:

#91248

This is what I wrote (except that I put (1) instead of [1]), but it did not change the results. The lonely solution seems to be working on a 10 min timeframe instead of a 5 min one.

#91298

No, this is not what you wrote, High[1] is not the same as DHigh(1), please try the above solution.

I can’t replicate your issue, this is why I’d like you to test the code I gave on the last post, thank you.

#91430

Splendid!
It does work now. I now understand that with the instruction TIMEFRAME(daily) I should not use Dhigh() but only high[], etc.
Thank you Nicolas!

###### 1 user thanked author for this post.
Viewing 13 posts - 1 through 13 (of 13 total)