Zero lag EMA

Optuma Forums Optuma Scripting Zero lag EMA

This topic contains 1 reply, has 2 voices, and was last updated by Matthew Matthew 2 months, 2 weeks ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #53883
    Avatar
    Steve
    • Topics: 12
    • Replies: 17
    • Posts: 29

    I’m trying to create a zero lag EMA script but there seems to be an error with my syntax.

    The formula (from https://www.technicalindicators.net/indicators-technical-analysis/182-zlema-zero-lag-exponential-moving-average) is:

    Lag: [(n day’s period -1) /2 ]

    Entry data for EMA: [Close + (Close – Close of the day lag ago)]

    ZLEMA = EMA of (Entry data for EMA)

     

    My script is (for a 50 period ZLEMA):

     

    P1 = 50;

    Lag = ((P1 – 1 ) / 2 );

    EMA1 = (Close() + (Close() – Close(Lag) ) );

    ZLEMA = EMA(EMA1);

     

    Where am I going wrong?

     

    Thanks

    Steve

     

    #53903
    Matthew
    Matthew
    • Topics: 4
    • Replies: 186
    • Posts: 190

    Hi Steve,

    I think the issue is how you’re referencing P1 in the second line.  For information on how to reference a variable like that please refer to the following article:

    https://help.optuma.com/kb/faq.php?id=964

    Additionally on the last line, EMA() is not a valid scripting function.  You’d need to use MA(STYLE=Exponential)

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

You must be logged in to reply to this topic.

Pin It on Pinterest

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close