Does it matter if I make var AFPArray = new Array() a local variable within preMain?
I believe it would reduce the load on the global namespace (if that is where globals are kept).
I don't want to miss something important since I have always seen it outside of preMain.
In testing some menu options I found that declaring var AFPArray = new Array() just after the function preMain() has the same effect as making it global outside of preMain as the sample efs below shows:
Wayne
I believe it would reduce the load on the global namespace (if that is where globals are kept).
I don't want to miss something important since I have always seen it outside of preMain.
In testing some menu options I found that declaring var AFPArray = new Array() just after the function preMain() has the same effect as making it global outside of preMain as the sample efs below shows:
PHP Code:
debugClear();
function preMain() {
var aFPArray = new Array();
var x=0;
aFPArray[x] = new FunctionParameter("vSymbol", FunctionParameter.STRING);
with(aFPArray[x++]){
addOption("$TRIN");
addOption("$ADD");
addOption("$TICK");
addOption("None");
setDefault("$ADD");
}
aFPArray[x] = new FunctionParameter("Interval", FunctionParameter.STRING);
with(aFPArray[x++]){
setName( "Price Interval" );
addOption("D");
addOption("W");
addOption("M");
setDefault( "D" );
}
}
var bInit = false;
function main(vSymbol,Interval0){
if(!bInit){
debugPrintln("25S: " + vSymbol + ", I: " + Interval0);
fTest(26,vSymbol,Interval0);
bInit = true;
}
if(getCurrentBarIndex() == 0){
debugPrintln("29S:" + vSymbol + ", I: " + Interval0);
fTest(31,vSymbol,Interval0);
}
}
var fInit = false;
function fTest(n,fSymbol,fInterval0){
if(!fInit){
debugPrintln(n + ": 37S: " + fSymbol + ", I: " + fInterval0);
fInit = true;
}
if(getCurrentBarIndex() == 0){
debugPrintln(n + ": 41S:" + fSymbol + ", I: " + fInterval0);
}
}