Zero lag EMA

Optuma Forums Optuma Scripting Zero lag EMA

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #53883
    • Topics: 15
    • Replies: 18
    • Posts: 33

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

    The formula (from 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?





    • Topics: 4
    • Replies: 255
    • Posts: 259

    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:

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

    • This reply was modified 11 months, 1 week ago by MatthewMatthew.
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.