When printing variables from within 2 separate functions the debugPrint output for each function is separate. i.e. the output window will print all the TmpVar1 values for each bar then print TmpVar2 instead of printing TmpVar1 and TmpVar2 for each bar together. Historical bars produce this:
...
bar index -22 TmpVar1
bar index -23 TmpVar1
bar index -24 TmpVar1
...
bar index -22 TmpVar2
bar index -23 TmpVar2
bar index -24 TmpVar2
However, in real time mode the variables are printed together as in:
bar index 0 TmpVar1
bar index 0 TmpVar2
Can someone explain why the entire formula is not processed for each bar sequentially on historical bars?
I suspect the answer will also explain some trouble I was having updating an array in a user function.
...
bar index -22 TmpVar1
bar index -23 TmpVar1
bar index -24 TmpVar1
...
bar index -22 TmpVar2
bar index -23 TmpVar2
bar index -24 TmpVar2
However, in real time mode the variables are printed together as in:
bar index 0 TmpVar1
bar index 0 TmpVar2
Can someone explain why the entire formula is not processed for each bar sequentially on historical bars?
I suspect the answer will also explain some trouble I was having updating an array in a user function.
PHP Code:
function main() {
if (!bInit) {
xSeries1 = efsInternal("CalcSeries1");
xSeries2 = efsInternal("CalcSeries2");
bInit=true;
}
// get values for each series
var nV1 = xSeries1.getValue(0);
var nV2 = xSeries2.getValue(0);
// do more stuff
return new Array(nV1, nV2);
}
function CalcSeries1();
// do stuff
debugPrintln(TmpVar1);
return (xx);
}
function CalcSeries2();
// do stuff
debugPrintln(TmpVar2);
return (zz);
}