In the code below,
Symbol and Interval print as null.
The other ways shown in the code are ok.
I don't understand why the values of Symbol, Interval and vSymbol are not available outside of the inital if (bInit) block?
Any explanations?
Thanks,
jgr
var bInit = false;
var xMA = null;
var tempv = null;
var curSym = null;
var curInt = null;
function main(Type,Length,Source,Symbol,Interval,Offset,Par ams) {
if(bInit == false){
if(Symbol == null) Symbol = getSymbol();
if(Interval == null) Interval = getInterval();
var vSymbol = Symbol+","+Interval;
xMA = offsetSeries(eval(Type)(Length,eval(Source)(sym(vS ymbol))),Offset);
setShowTitleParameters(eval(Params));
curSym = Symbol;
curInt = Interval;
tempv = vSymbol;
bInit = true;
}
var temps = getCurrentBarIndex();
var tempsym = getSymbol();
var tempint = getInterval();
debugPrintln("Got Here: Count: "+temps);
debugPrintln("symbol: "+Symbol+" Interval: "+Interval+" vSymbol: "+vSymbol);
debugPrintln("curSym: "+curSym+" curInt: "+curInt);
debugPrintln("tempsym: "+tempsym+" tempint: "+tempint+" tempv: "+tempv);
debugPrintln(" ");
return getSeries(xMA);
Symbol and Interval print as null.
The other ways shown in the code are ok.
I don't understand why the values of Symbol, Interval and vSymbol are not available outside of the inital if (bInit) block?
Any explanations?
Thanks,
jgr
var bInit = false;
var xMA = null;
var tempv = null;
var curSym = null;
var curInt = null;
function main(Type,Length,Source,Symbol,Interval,Offset,Par ams) {
if(bInit == false){
if(Symbol == null) Symbol = getSymbol();
if(Interval == null) Interval = getInterval();
var vSymbol = Symbol+","+Interval;
xMA = offsetSeries(eval(Type)(Length,eval(Source)(sym(vS ymbol))),Offset);
setShowTitleParameters(eval(Params));
curSym = Symbol;
curInt = Interval;
tempv = vSymbol;
bInit = true;
}
var temps = getCurrentBarIndex();
var tempsym = getSymbol();
var tempint = getInterval();
debugPrintln("Got Here: Count: "+temps);
debugPrintln("symbol: "+Symbol+" Interval: "+Interval+" vSymbol: "+vSymbol);
debugPrintln("curSym: "+curSym+" curInt: "+curInt);
debugPrintln("tempsym: "+tempsym+" tempint: "+tempint+" tempv: "+tempv);
debugPrintln(" ");
return getSeries(xMA);
Comment