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

This topic contains 7 replies, has 3 voices, and was last updated by avatar skfomx 1 year, 4 months ago.

View all attachments
Viewing 8 posts - 1 through 8 (of 8 total)
  • #77903

    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!


    This is the code:




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


    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.

    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.

    Thanks a lot for taking the time to help out!




    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)

Create your free account now and post your request to benefit from the help of the community
Register or Login