# How to identify the closest pivot points level to current price

Forums ProRealTime English forum ProOrder support How to identify the closest pivot points level to current price

This topic contains 23 replies, has 5 voices, and was last updated by  GraHal 1 week, 4 days ago.

View all attachments
Viewing 9 posts - 16 through 24 (of 24 total)
• #91013

Also be aware that on a Monday your daily pivots will be based on a small Sunday candle.

#91014

Already made provision for the Sunday candle on Mondays by using DClose(2), DHigh(2) and DLow(2) if dayofweek = 1

#91015

It is almost like the code only updates line 68-237 Daily instead of on the Timeframe(Default) as specified.

#91017

Found 3 major bugs in my code, Line 119, 175, 231 (each should be the same Pivot as in the first part of the if statement). Typical copy/paste issue 🙂

#91019

Okay so here is the ‘fixed’ code. It now correctly identifies the pivot directly above and below the last close. I am now trying to find the pivot levels two levels above an below the code. The logic I am now following is that I am measuring against either PivotAbove or PivotBelow instead of close. When graphed the results are correct here and there but often it either makes PivotAbove2 = PivotAbove or PivotBelow2 = PivotBelow

#91028

With this small code snippet, you’ll be able to find the nearest pivot points: (lines 26 to 89)

https://www.prorealcode.com/topic/fractal-systeme/page/2/#post-88943

Adapt it to weekly, monthly points..

###### 1 user thanked author for this post.
#91029

I’ve now had time to actually read your code! I can’t explain why you sometimes get exactly the same values – maybe you need to graph every pivot line and see what their values actually are.

Also I notice sometimes that there may not actually be a pivot line above or below price and so you are left with a value of 10000 or zero. Not a major problem in a strategy as long as you take it into consideration in the code.

#91035

@nicolas @vonasi, thank you for all your help managed to get my code working perfectly. Just had to initialize each Pivot Above and Pivot Below level at the beginning instead of in the If statements.

#91042

With this small code snippet, you’ll be able to find the nearest pivot points: (lines 26 to 89)

I just added above to here