# Help with coding average price based on pivots and moving averages

Forums ProRealTime English forum ProBuilder support Help with coding average price based on pivots and moving averages

Currently, there are 0 users and 1 guest visiting this topic.
View all attachments
Viewing 8 posts - 1 through 8 (of 8 total)
• #77903 Report

Hi there!

I am a newbie trying to create an indicator that produces an average daily price by combining daily, weekly, and monthly pivots and simple moving average 5, 20,50,100,200. I want to give more weight to the pivot points compared to the moving averages so I duplicate the pivot point numbers before dividing all of them.

Pro realtime does not like the indicator. It works on some instruments but not on others. For example it works on aud/cad but not on eur/usd.

Calculation error: “A positive integer field is expected with highest”

Can anyone help? It would be much appreciated!

#77904 Report

This is the code:

#77905 Report

To write code, please use the <> “insert PRT code” button, to make code easier to read and understand. Thank you.

#77906 Report

It’s because in line 6 you set

so in line 30 the expression

the first time will evaluate to

which is not allowed.

###### 1 user thanked author for this post.
#77930 Report

Roberto is right, because the first barindex is 1 and obviously 1 minus 1 = 0.

You can modify your line 30 with:

Do the same for lines 31, 47 and 48.

###### 2 users thanked author for this post.
#77991 Report

Thanks a lot for taking the time to help out!

#79527 Report

#79528 Report

I would like to create another version of this indicator for intraday timeframes. I would like to use a 10 minute chart and create the average price by combining moving average 5, 20, 50, 100, 200 and then combine that with hourly pivot, 4 hour pivot and daily pivot points.

Can anyone guide me in how to achieve this? Thanks again to Roberto Gozzi and Nicolas for helping out with the first version!

Viewing 8 posts - 1 through 8 (of 8 total)