All time average in an indicator.

Forums ProRealTime English forum ProBuilder support All time average in an indicator.

Viewing 3 posts - 1 through 3 (of 3 total)
  • #75196

    I’m coding an indicator and I wanted to calculate an all time average of a value in it but I couldn’t get a value out of it. Here a simplified version of the first attempt:

    I then changed it to this and it works:

    I’m trying to understand why one works and the other doesn’t – can anyone explain?

    #75197

    First time you made the calculation, d is equal to 0 and thus made a division by zero error.

    #75200

    Is this because the values are calculated live/on the fly? My brain is thinking the value is set at bar close but that might be because it has spent too much time doing end of bar strategies!

    So it is the same if you want to use the AVERAGE instruction – you must do this:

    or even this slightly messy version:

    or even this:

     

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

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