If I wrote this correctly, syncronization between the MA's and the 5 min chart seems off a bit.
I also tried it by setting
ma250V = ema(2, sym("ES #F,250V"));
ma150T = ema(2, sym("ES #F,150T"));
PHP Code:
function preMain(){
setPriceStudy(true);
setShowTitleParameters(false);
setStudyTitle("two MA's");
setShowCursorLabel(true);
setCursorLabelName("250V", 0);
setCursorLabelName("150T", 1);
setDefaultBarFgColor(Color.blue, 0);
setDefaultBarFgColor(Color.red, 1);
setDefaultBarThickness(2,0);
setDefaultBarThickness(2,1);
}
var ma250V = 0;
var ma150T = 0;
function main(){
if (getBarState() == BARSTATE_ALLBARS) {//true once during initial load and subsequent reload
ma250V = ema(2, inv("250V"));
ma150T = ema(2, inv("150T"));
}
return new Array(ma250V.getValue(0), ma150T.getValue(0));
}
ma250V = ema(2, sym("ES #F,250V"));
ma150T = ema(2, sym("ES #F,150T"));
Comment