PureBytes Links
Trading Reference Links
|
I'm having problems with a divide by zero calculation my formula for the
True Strength Indicator as attempted from articles I've seen in TASC.
Even when I use the conplete denominator as part of the If statement it
still comes up with divide by 0 problems.
This code works about 80% of the time.
Does anyone have a working version of this indicator?
{True Strength Indicator}
input: length1(34), length2(8),length3(5);
If(absvalue(c-c[1])<>0) then begin;
Plot1(100*(xaverage(xaverage(c-c[1],length1),length2)/(xaverage(xaverage(absvalue(c-c[1]),length1),length2))),"Plot1");
Plot2(xaverage(100*(xaverage(xaverage(c-c[1],length1),length2)/(xaverage(xaverage(absvalue(c-c[1]),length1),length2))),length3),"Plot2");
Plot3((0),"Plot3");
end;
|