Exponential Average of Candle Value Intermittently Flat Lines

Forums ProRealTime English forum ProBuilder support Exponential Average of Candle Value Intermittently Flat Lines

Viewing 7 posts - 1 through 7 (of 7 total)
  • #170079

    I am trying to code a very simple exponential average (60) of a calculated candle value, it sometimes stops calculating and flatlines which is strange. There has to be an error in my code as the candle value still calculates. To see it better I have scaled the values up

    Does anyone have any idea as to why this is happening I have tried a few things to no success.

     

    #170090

    It’s quite weird, I tested it on DAX, different TF’s, even replacing AVERAGE with EXPONENTIALAVERAGE, but it still plots flat lines almost everyday.

    It occurs mainly on Indices (Dax, Ftse, Nikkei, Cac40, Russel, Nasdaq, S&P500 and Dow Jones ). As to FX pairs I experienced the same issue on NZD/CHF, GBP/CAD and GBP/CHF (I did only test it on about 15 pairs).

    I have no idea why.

    I suggest that you open a ticket for assistamce (press Ctrl+M from the platform).

     

     

     

    #170107

    Yeah same Robertogozzi I also tried EXPONENTIALAVERAGE and same issue I shall raise a ticket and update with the feedback. Thanks for looking into this

    #170108

    You divide by (high-low) in line 8, which creates undefined values when high=low because of division by 0, and propagates the undefined through the averages. You can try to surround your line 8 by “if high<>low then … endif” and see if it achieves what you expect.

    2 users thanked author for this post.
    #170123

    Well spotted Noobywan!

    You can replace line 8 with this one:

    #170124

    Maybe this a better solution, replace lines 8-9 with:

    1 user thanked author for this post.
    #170160

    Great spot Noobywan, Robertogozzi that last code works great as expected thanks guys.

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

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