Good Morning,
Is there a way to change the syntax or structure of the moving average formulas in the following portion of an EFS to force the getValue command (including the look back in variable M1A2) to calculate the 1 minute moving average on a 1 minute only bases and not on each tick when this EFS is applied to a 10 tick chart for both real time and playback modes?
Best Regards,
Alan
Symbol1 = "$playback";
Interval1 = "1M";
}
function main() {
var TT3 = (0)
var WW3 = (2)
var QQ3 = (-2)
var vSymbol1 = getSymbol()+","+Interval1;
x1MA1 = offsetSeries(eval(sma)(5,eval(close)(sym(vSymbol1) )),0);
x1MA2 = offsetSeries(eval(sma)(21,eval(close)(sym(vSymbol1 ))),0);
var M1A1 = (x1MA1.getValue(0));
var M1A2 = (x1MA2.getValue(-3));
qwsx = 0.0;
if(M1A1 >= M1A2) {
qwsx = 1.5;
}
if(M1A1 < M1A2) {
qwsx = -1.5;
}
return (qwsx);
}
Is there a way to change the syntax or structure of the moving average formulas in the following portion of an EFS to force the getValue command (including the look back in variable M1A2) to calculate the 1 minute moving average on a 1 minute only bases and not on each tick when this EFS is applied to a 10 tick chart for both real time and playback modes?
Best Regards,
Alan
Symbol1 = "$playback";
Interval1 = "1M";
}
function main() {
var TT3 = (0)
var WW3 = (2)
var QQ3 = (-2)
var vSymbol1 = getSymbol()+","+Interval1;
x1MA1 = offsetSeries(eval(sma)(5,eval(close)(sym(vSymbol1) )),0);
x1MA2 = offsetSeries(eval(sma)(21,eval(close)(sym(vSymbol1 ))),0);
var M1A1 = (x1MA1.getValue(0));
var M1A2 = (x1MA2.getValue(-3));
qwsx = 0.0;
if(M1A1 >= M1A2) {
qwsx = 1.5;
}
if(M1A1 < M1A2) {
qwsx = -1.5;
}
return (qwsx);
}
Comment