Hello,
If I want to use only the current values of the variables vADV and vDECL in a calculation, is Case 1 below just as efficient (in terms of computer resources) as Case 2 for getting those values? Would Case 1 be even more efficient for any reason?
I understand that case 2 retreives each series, so would Case 2 only be needed if I also needed the ___.getValue(-1) values for my calculation as well?
Thanks
shaeffer
If I want to use only the current values of the variables vADV and vDECL in a calculation, is Case 1 below just as efficient (in terms of computer resources) as Case 2 for getting those values? Would Case 1 be even more efficient for any reason?
I understand that case 2 retreives each series, so would Case 2 only be needed if I also needed the ___.getValue(-1) values for my calculation as well?
Thanks
shaeffer
PHP Code:
//--- CASE 1 --------------------------------------------------
function main() {
var vADV;
var vDECL;
vADV = close(0, sym("$ADV"));
vDECL = close(0, sym("$DECL"));
//--- CASE 2 -----------------------------------------------------------
var xADV = null;
var xDECL = null;
var bInit = false;
function main(){
var vADV;
var vDECL;
if(bInit == false){
xADV = close(sym("$ADV"));
xDECL = close(sym("$DECL"));
bInit = true;
}
vADV = xADV.getValue(0)
vDECL = xDECL.getValue(0)
//---------------------------------------------------------------
Comment