Announcement

Collapse
No announcement yet.

Zero values and Moving Averges

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

  • Zero values and Moving Averges

    Hi All,

    I have this simple function which is used to create a Series object:

    PHP Code:
    function getOpenCloseRangeValue(objOpenSeriesobjCloseSeries){
        
        var 
    nRangeValue null
        
        if(
    objOpenSeries != null && objCloseSeries != null){
        
            var 
    nOpen     objOpenSeries.getValue(0);
            var 
    nClose    objCloseSeries.getValue(0);
            
            if(
    nOpen != null && nClose != null
                
    nRangeValue Math.abs(nClose nOpen);
        }
        
        return 
    nRangeValue;

    Now it is possible that the return value may be zero (same Open and Close). If I pass a Series generated through an 'efsInternal' call to a Moving Average function (doesn't seem to matter which one: sma, ema, wma), the returned series object sometimes is null.

    However if I make a small change to my function by adding the following line at the end, the issue is fixed - as far as nullity goes.

    PHP Code:
    if(nRangeValue == 0nRangeValue null
    However by doing this I'm tampering with the data. In this case a Zero value is not the same as null.

    Has anyone ever come across a similar problem? Does anyone know a solution?

    Thanks

    G.

  • #2
    The problem is intermittent for the same symbol. Meaning if the Series was null before, adding a new value may reset it to normal.

    Also the zero value does not have to be the last value in the series. In fact most of the time it isn't.

    I would also add that this problem does not exist in eSignal v10.6.
    Last edited by gekko71; 03-27-2013, 04:58 PM.

    Comment

    Working...
    X