Anyone know the fix for this Ergotic Tsi indicator?
It's not accuratly updating in real-time, I have to keep hitting refresh.
Thanks
/************************************************** *****************
Description : This Indicator plots Ergotic_TSI indicator
Provided By : Developed by TS Support, LLC for eSignal. (c) Copyright 2002
************************************************** ******************/
function preMain()
{
setStudyTitle("Ergotic_TSI");
setCursorLabelName("ErgTSI", 0);
setCursorLabelName("SigLin", 1);
setCursorLabelName("ZeroLine", 2);
setDefaultBarFgColor(Color.red, 0);
setDefaultBarFgColor(Color.blue, 1);
setDefaultBarFgColor(Color.blue, 2);
}
var XA1_1 = 0.0;
var XA2_1 = 0.0;
var XA3_1 = 0.0;
var aXA1_1 = 0.0;
var aXA2_1 = 0.0;
var aXA3_1 = 0.0;
var XA_1 = 0.0;
function main(sPrice, r, s, u, ZeroLine, SmthLen)
{
if (sPrice == null) sPrice = "Close";
if (r == null) r = 4;
if (s == null) s = 8;
if (u == null) u = 6;
if (ZeroLine == null) ZeroLine = 0;
if (SmthLen == null) SmthLen = 3;
var Price = getValue(sPrice, 0, -2);
var vPrice = Price[0] - Price[1];
var FactorR = 2 / (r + 1);
var FactorS = 2 / (s + 1);
var FactorU = 2 / (u + 1);
var XA1 = FactorR * vPrice + (1 - FactorR) * XA1_1;
var XA2 = FactorS * XA1 + (1 - FactorS) * XA2_1;
var XA3 = FactorU * XA2 + (1 - FactorU) * XA3_1;
vPrice = Math.abs(Price[0] - Price[1]);
var aXA1 = FactorR * vPrice + (1 - FactorR) * aXA1_1;
var aXA2 = FactorS * aXA1 + (1 - FactorS) * aXA2_1;
var aXA3 = FactorU * aXA2 + (1 - FactorU) * aXA3_1;
var Val1 = 100 * XA3;
var Val2 = aXA3;
var TSI = 0.0;
if (Val2 != 0) TSI = Val1 / Val2;
else TSI = 0.0;
var Factor = 2 / (SmthLen + 1);
var XA = Factor * TSI + (1 - Factor) * XA_1;
if (getBarState() == BARSTATE_NEWBAR)
{
XA1_1 = XA1;
XA2_1 = XA2;
XA3_1 = XA3;
aXA1_1 = aXA1;
aXA2_1 = aXA2;
aXA3_1 = aXA3;
XA_1 = XA;
}
return new Array(TSI, XA, ZeroLine);
}
It's not accuratly updating in real-time, I have to keep hitting refresh.
Thanks
/************************************************** *****************
Description : This Indicator plots Ergotic_TSI indicator
Provided By : Developed by TS Support, LLC for eSignal. (c) Copyright 2002
************************************************** ******************/
function preMain()
{
setStudyTitle("Ergotic_TSI");
setCursorLabelName("ErgTSI", 0);
setCursorLabelName("SigLin", 1);
setCursorLabelName("ZeroLine", 2);
setDefaultBarFgColor(Color.red, 0);
setDefaultBarFgColor(Color.blue, 1);
setDefaultBarFgColor(Color.blue, 2);
}
var XA1_1 = 0.0;
var XA2_1 = 0.0;
var XA3_1 = 0.0;
var aXA1_1 = 0.0;
var aXA2_1 = 0.0;
var aXA3_1 = 0.0;
var XA_1 = 0.0;
function main(sPrice, r, s, u, ZeroLine, SmthLen)
{
if (sPrice == null) sPrice = "Close";
if (r == null) r = 4;
if (s == null) s = 8;
if (u == null) u = 6;
if (ZeroLine == null) ZeroLine = 0;
if (SmthLen == null) SmthLen = 3;
var Price = getValue(sPrice, 0, -2);
var vPrice = Price[0] - Price[1];
var FactorR = 2 / (r + 1);
var FactorS = 2 / (s + 1);
var FactorU = 2 / (u + 1);
var XA1 = FactorR * vPrice + (1 - FactorR) * XA1_1;
var XA2 = FactorS * XA1 + (1 - FactorS) * XA2_1;
var XA3 = FactorU * XA2 + (1 - FactorU) * XA3_1;
vPrice = Math.abs(Price[0] - Price[1]);
var aXA1 = FactorR * vPrice + (1 - FactorR) * aXA1_1;
var aXA2 = FactorS * aXA1 + (1 - FactorS) * aXA2_1;
var aXA3 = FactorU * aXA2 + (1 - FactorU) * aXA3_1;
var Val1 = 100 * XA3;
var Val2 = aXA3;
var TSI = 0.0;
if (Val2 != 0) TSI = Val1 / Val2;
else TSI = 0.0;
var Factor = 2 / (SmthLen + 1);
var XA = Factor * TSI + (1 - Factor) * XA_1;
if (getBarState() == BARSTATE_NEWBAR)
{
XA1_1 = XA1;
XA2_1 = XA2;
XA3_1 = XA3;
aXA1_1 = aXA1;
aXA2_1 = aXA2;
aXA3_1 = aXA3;
XA_1 = XA;
}
return new Array(TSI, XA, ZeroLine);
}
Comment