What follows below is the code I would like to work with that was copied from the custom indicator
https://usethinkscript.com/threads/ehlers-ultimate-smoother-for-thinkorswim.18243/
that I was using to troubleshoot. This should run as a scrip, but for me does not. The code will however, run when removed from the script restriction.
Other indicators that I have where scripts are embedded, all work well. For me running this script breaks on the line... c2 * us[1] + c3 * us[2]; When it encounters the look-back call us[1], that's where the code breaks.
I do not see anything that would prevent it from working, it should run.
Was hoping someone may have seen something unusual like this before that could explain why this is occurring, and recommend a fix.
input src = close;
input length = 20;
input displace = 0;
script us{
input src = close;
input length = 20;
input displace = 0;
def a1 = Exp(-Sqrt(2) * Double.Pi / length);
def c2 = 2.0 * a1 * Cos(Sqrt(2) * Double.Pi / length);
def c3 = -a1 * a1;
def c1 = (1.0 + c2 - c3) / 4.0;
def us =
(1.0 - c1) * src +
(2.0 * c1 - c2) * src[1] -
(c1 + c3) * src[2] +
c2 * us[1] + c3 * us[2];
plot ultimate = CompoundValue(4,us[-displace],src);
}
plot ultimate = us(src,length,displace);
ultimate.SetLineWeight(2);
https://usethinkscript.com/threads/ehlers-ultimate-smoother-for-thinkorswim.18243/
that I was using to troubleshoot. This should run as a scrip, but for me does not. The code will however, run when removed from the script restriction.
Other indicators that I have where scripts are embedded, all work well. For me running this script breaks on the line... c2 * us[1] + c3 * us[2]; When it encounters the look-back call us[1], that's where the code breaks.
I do not see anything that would prevent it from working, it should run.
Was hoping someone may have seen something unusual like this before that could explain why this is occurring, and recommend a fix.
input src = close;
input length = 20;
input displace = 0;
script us{
input src = close;
input length = 20;
input displace = 0;
def a1 = Exp(-Sqrt(2) * Double.Pi / length);
def c2 = 2.0 * a1 * Cos(Sqrt(2) * Double.Pi / length);
def c3 = -a1 * a1;
def c1 = (1.0 + c2 - c3) / 4.0;
def us =
(1.0 - c1) * src +
(2.0 * c1 - c2) * src[1] -
(c1 + c3) * src[2] +
c2 * us[1] + c3 * us[2];
plot ultimate = CompoundValue(4,us[-displace],src);
}
plot ultimate = us(src,length,displace);
ultimate.SetLineWeight(2);
Last edited by a moderator: