im trying run a moving average on the a series returned from efsInternal(). I thought this was quite simple, as the following example does what intended on chart reload. The problem is when the bars update in realtime all i get is a straight line from the moving average. What am i missing here. In this example i have reduced the function used to something basic returning a barnumber.
This study uses computeonclose()
Another funny observation is the formula output at the end of historical reload and the beginning of realtime output.
xIntSeries=null // why do these become null in realtime
xIntSeries=null
xIntSeries=1298
1298
xIntSeries=null
xIntSeries=1296
xIntSeries=1297
1297
xIntSeries=1294
xIntSeries=1295
xIntSeries=1296
1296
This study uses computeonclose()
Code:
var xIntSeries = null; function main(){ var nBarIndex = getCurrentBarCount()-1; debugPrintln(nBarIndex); xIntSeries = efsInternal( "myinternal"); debugPrintln("xIntSeries="+xIntSeries.getValue(0)); debugPrintln("xIntSeries="+xIntSeries.getValue(1)); debugPrintln("xIntSeries="+xIntSeries.getValue(2)); vSMA = sma(20,xIntSeries); return new Array (xIntSeries.getValue(0), vSMA.getValue(0) ); } function myinternal(){ var nBarIndex = getCurrentBarCount()-1; return nBarIndex; }
xIntSeries=null // why do these become null in realtime
xIntSeries=null
xIntSeries=1298
1298
xIntSeries=null
xIntSeries=1296
xIntSeries=1297
1297
xIntSeries=1294
xIntSeries=1295
xIntSeries=1296
1296
Comment