I am having a hard time refrencing the value of vEMA for the last completed bar on the chart. plots fine until the current bar in realtime. then the indicator quickly "pulls in " to the current close(). Have tried everything i can think of any thoughts. (sorry for the ugly code but i'm new to efs)
function main(Length,Length2) {
var nHL = efsInternal("myCTR"); //this calls the function "range" and creates a series
vEMA = ema(Length,ema(Length2,nHL)); //the series is used as an input to the builtin study
return new Array( vEMA);
}
//this is the separate function that calculates the center
function myCTR() {
if(bInit == false){
vCtr = close(); // initialize vCtr
// bInit = true;
// }
oCtr = vCtr; // this is where i get hung up need to get oCtr equal to vEMA from last completed bar
vCtr = (oCtr *8 + close())/9;
return (vCtr);
}
function main(Length,Length2) {
var nHL = efsInternal("myCTR"); //this calls the function "range" and creates a series
vEMA = ema(Length,ema(Length2,nHL)); //the series is used as an input to the builtin study
return new Array( vEMA);
}
//this is the separate function that calculates the center
function myCTR() {
if(bInit == false){
vCtr = close(); // initialize vCtr
// bInit = true;
// }
oCtr = vCtr; // this is where i get hung up need to get oCtr equal to vEMA from last completed bar
vCtr = (oCtr *8 + close())/9;
return (vCtr);
}
Comment