Announcement

Collapse
No announcement yet.

intraday EMA not calculated fully on higher timeframes - bug?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • intraday EMA not calculated fully on higher timeframes - bug?

    I'm trying to use the EMA of an intraday chart as part of an indicator on forex daily and weekly charts however I am finding that the calculation of the EMA stops at the end of the previous day (the result returned from the EMA function effectively gets stuck at the result of the bar at midnight the previous day and does not get updated as new ticks come in). If I drop the daily/weekly chart back down to an intraday chart then the EMA works correctly and I am able to view the 'live' EMA in realtime.
    I am finding this is only a bug on the latest version of eSignal (currently i'm running v11.7.3386.1006 64-bit) - I tried it in v10.6 and the EMA returns the correct value for the current time regardless of what timeframe chart I have the EFS attached to, as I would have expected it to.

    I have tried the ema() function as well as MAStudy() using efsInternal() but they both return the same result (see code below).

    Can someone confirm what I am seeing is possibly a bug or am I doing something wrong?

    Here is the bit of test code that I am using:

    Code:
    function preMain()
    {
        setStudyTitle("EMA Test");
        setShowCursorLabel(true);
        setPriceStudy(true);
    }
    
    var pair = getSymbol();
    
    function main()
    {
        //Only uncomment one or the other to test each method.
        var price = ema(10, sym(pair+",60"));    
    //    var price = efsInternal("calcEMA", 10, sym(pair+",60"));
        
        return price;
    }
    
    var vEMA = null;
    function calcEMA(period, symbol)
    {
        if(vEMA == null)
            vEMA = new MAStudy(period, 0, "Close", MAStudy.EXPONENTIAL);
    
        return vEMA.getValue(MAStudy.MA);
    }
Working...
X