Detect cross 4 hour pivots? (incl. example)
Forums › ProRealTime English forum › ProScreener support › Detect cross 4 hour pivots? (incl. example)
- This topic has 10 replies, 3 voices, and was last updated 11 months ago by JS.
-
-
12/13/2023 at 7:17 AM #225165
I am working on creating a strategy in which a candle passes through the lines of a 4-hour pivot. The formulas of the pivots correspond to IG Markets, so the values of the pivots correspond to the standard indicator in pro real time.
The script below does not work during testing. It gives random results, but not when the lines go through a pivot. What am I overlooking here? In the attachment there is another image to explain the situation.123456789101112131415161718192021222324Timeframe(4 hours)// Formula Pivots H4P4 = (high + low + close)/3P4R1 = (2*P4) - lowP4R2 = P4 + high - lowP4R3 = high + 2*(P4-low)P4R4 = P4R3 + (high - low)P4S1 = (2*P4) - highP4S2 = P4 - (high - low)P4S3 = low - 2*(high - P4)P4S4 = P4S3 - (high - low)Timeframe(default)Timeframe (1 minute)c1= high[1] > P4 AND low[1] < P4c2= (high[1] > P4R1 AND low[1] < P4R1) OR (high[1] > P4R2 AND low[1] < P4R2) OR (high[1] > P4R3 AND low[1] < P4R3) OR (high[1] > P4R4 AND low[1] < P4R4)c3= (high[1] > P4S1 AND low[1] < P4S1) OR (high[1] > P4S2 AND low[1] < P4S2) OR (high[1] > P4S3 AND low[1] < P4S3) OR (high[1] > P4S4 AND low[1] < P4S4)IF c1 OR c2 OR c3 THENsignal = 1screener [ signal > 0 ] sort by signal as "TEST"ENDIF12/13/2023 at 8:50 AM #22516712/13/2023 at 10:14 AM #22518612/13/2023 at 10:57 AM #22519412/13/2023 at 11:33 AM #22519912/13/2023 at 11:42 AM #225201If I place the pivots as a ‘separate indicator’ under the graph, you see that the values of the outcome are equal to the standard pivot in PRT. So the formulas for all pivot values 4 hours are correct. Only detecting when a candle is closed on the line has not been possible so far 🙁
12/13/2023 at 12:53 PM #22521012/13/2023 at 1:48 PM #225226@JS,
Do you know the reason why you use P4[1] instead of P4? Your idea was the right way, looks like it works! I am very curious about the explanation…. I will continue testing in the coming days.
Thanks for your quick response, great!12/13/2023 at 2:13 PM #225227Hi Robin,
It’s great that it worked.
For example, suppose you use a current price (Close) to check whether the price is higher or lower than the same current price (Close), then you understand that this is not going to work.
The solution is to use the previous price (Close[1]) and check it with the current price…
Close>Close[1] or in this case High>P4[1]
01/21/2024 at 10:15 AM #22665301/21/2024 at 10:49 AM #226654 -
AuthorPosts
Find exclusive trading pro-tools on