Is there a problem creating 2 series in a called function?
I am creating Series1 and using that to make Series2 then getting an MA of Series 2. The calculation of Series1 uses an ATR. No problem at this point. But when I added a volume series to fCalcBarVal, I lost the MA. If I don't use the volume series I can retrieve the MA of the Series2 without problem.
I am creating Series1 and using that to make Series2 then getting an MA of Series 2. The calculation of Series1 uses an ATR. No problem at this point. But when I added a volume series to fCalcBarVal, I lost the MA. If I don't use the volume series I can retrieve the MA of the Series2 without problem.
PHP Code:
if (!bInit) {
xSeries1 = efsInternal("fCalcBarVal", var1, var2);
xSeries2 = efsInternal("fCalcS2", var3, xSeries1);
xMA = ema(nLen, xSeries2); // losing this value
bInit=true;
}
...
function fCalcBarVal(v1, v2) {
if (!bInit2) {
xATR=atr(v1);
xMAV=sma(v2, volume() ); // when I add this
bInit2=true;
}
nATR=xATR.getValue(0);
nMAV=xMAV.getValue(0);
// do stuff with these values
...
return(BarVal);
}
Comment