Exponential average error in indicator?

Viewing 15 posts - 1 through 15 (of 23 total)
  • Author
    Posts
  • #111612 quote
    pieroim
    Participant
    Average

    Hi all,

    I took this indicator from a purchased book, but unfortunately in compiling it gives me an error .. I tried various ways to solve the error, but I can’t understand what’s wrong with this code.

    In particular I think I have identified the error in the ExponentialAverage.. I tried to pass “nn” after a Round function thinking it could be a problem with the format of the numbers, but nothing.

    The code according to the author of the book must work, he also inserted several examples of graphs with this indicator .. but it doesn’t go..

     

    if Barindex < 2 then
    BU = Close
    else
    BU = BU[1]-BU[2]/3.414+(1/3.414)*Close
    endif
    
    Signal = BU
    Noise = Close
    SigmaSignal = STD[PP](Signal)
    SigmaNoise = STD[PP](Noise)
    a = SigmaSignal/SigmaNoise
    n = (2/a)-1
    
    if n < 0 then
    nn = 1
    else
    nn = n
    endif
    
    //roundedROCvalue = ROUND(nn)
    
    MB = ExponentialAverage[nn](Close)
    
    Return MB COLOURED(0,250,0)
    #111626 quote
    robertogozzi
    Moderator
    Master

    Use more meaningful titles when creating a new topic. Thank you 🙂

    What error is reported? you can attach a picture of the error message.

    #111630 quote
    GraHal
    Participant
    Master

    Use pp = 20 (default value for STD) and the Indicator appears to work, but appears to follow Price profile??

    Pier.jpg Pier.jpg Oier-2.png Oier-2.png
    #111633 quote
    robertogozzi
    Moderator
    Master

    PP must be defined or assigned a value, as suggested by GraHal.

    You should use the value recommended in the book where you read it.

    GraHal thanked this post
    #111636 quote
    pieroim
    Participant
    Average

    PP is an exterval value set to 17,

    however now I have done other tests by setting both internal and external PP, even at 20, but it continues to always give me the same error

    errore.jpg errore.jpg
    #111638 quote
    pieroim
    Participant
    Average

    Use pp = 20 (default value for STD) and the Indicator appears to work, but appears to follow Price profile??

    SigmaSignal = STD[20](Signal)
    SigmaNoise = STD[20](Noise)

    Hi, I set it directly in the function, but I have the same error..

    Prorealtime v.11.1 – 1.8.0_45

    #111641 quote
    robertogozzi
    Moderator
    Master

    I have not used v11 so far. I don’t know what that error is.

    #111642 quote
    pieroim
    Participant
    Average

    Do you know if Nicolas is using the v 11? Maybe he knows this problem ..

    #111645 quote
    GraHal
    Participant
    Master

    Are you using (17) or correctly [17] … square brackets are needed??

    #111646 quote
    pieroim
    Participant
    Average

    [17]..

    this is the last tested with the same error

    if Barindex < 2 then
    BU = Close
    else
    BU = BU[1]-BU[2]/3.414+(1/3.414)*Close
    endif
    
    Signal = BU
    Noise = Close
    SigmaSignal = STD[17](Signal)
    SigmaNoise = STD[17](Noise)
    a = SigmaSignal/SigmaNoise
    n = (2/a)-1
    
    if n < 0 then
    nn = 1
    else
    nn = n
    endif
    
    MB = ExponentialAverage[nn](Close)
    Return MB COLOURED(0,250,0)
    #111648 quote
    GraHal
    Participant
    Master

    Above code works fine on v10.3 … I just ran it on my Platform

    #111649 quote
    pieroim
    Participant
    Average

    strange.. can you send me a picture with it attached to  micro SP500 future.. around last 50 bars? I need of it for testing reason.. this is a step of a more complex indicator.

    on M1 (minute) time frame..

    Thanks

    #111650 quote
    GraHal
    Participant
    Master

    I cant see micro SP500 future. as an option, but is this any good?

    Attached is what I see as Options for SPTRD

    Oier-2-1.png Oier-2-1.png Piere-4.png Piere-4.png
    #111653 quote
    pieroim
    Participant
    Average

    US500 (50$) dec19 is fine for me if you can..

    #111654 quote
    Vonasi
    Moderator
    Master

    Line 14 means that you could be looking for an average with a period of zero to 0.99999999 which will give an error. Change it to:

     
    if n < 1 then
Viewing 15 posts - 1 through 15 (of 23 total)
  • You must be logged in to reply to this topic.

Exponential average error in indicator?


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
pieroim @pieroim Participant
Summary

This topic contains 22 replies,
has 5 voices, and was last updated by pieroim
6 years, 3 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 10/30/2019
Status: Active
Attachments: 8 files
Logo Logo
Loading...