I'd like to calculate several series and store them in an array. See below. I don't get an error message with this but the debugPrintln command for xAverage doesn't work. It only returns "[object series]." So, I don't know how to reference individual values within this array. Any help will be appreciated. Thanks.
var bInit = false;
var xSymbol = new Array();
var xAverage = new Array();
var xList = new Array ("XOM","INTC","ORCL","IBM","MMM");
function main() {
if (getBarState() == BARSTATE_NEWBAR) {
for (var i=0;i<5;i++) {
xSymbol[i] = xList[i]+","+getInterval();
xAverage[i] = ema(5,close(sym(xSymbol)));
}
}
// Calculate some index with all these series
debugPrintln(xSymbol[1]);
debugPrintln(xAverage[1]);
return; //calculated index (one number)
}
var bInit = false;
var xSymbol = new Array();
var xAverage = new Array();
var xList = new Array ("XOM","INTC","ORCL","IBM","MMM");
function main() {
if (getBarState() == BARSTATE_NEWBAR) {
for (var i=0;i<5;i++) {
xSymbol[i] = xList[i]+","+getInterval();
xAverage[i] = ema(5,close(sym(xSymbol)));
}
}
// Calculate some index with all these series
debugPrintln(xSymbol[1]);
debugPrintln(xAverage[1]);
return; //calculated index (one number)
}
Comment