[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Error in Stochastic Classic?



PureBytes Links

Trading Reference Links

I'm confused by the Stochastic Classic indicator in TS2000i. When I
plotted it with parameters 35/10/1, it drew two lines. As I understand
it, 35 is the length of the FastK, and %K is the 10 period moving
average of this. %D is the 1 period moving average of %K, which means
it ought to be identical to %K. For every variation I tried when the
final parameter is 1, there were always two lines, %K was different
from %D.

I looked at the code and it relies on the FastDClassic function which has
a hard coded parameter.
  Inputs : KLength(NumericSimple);
  FastDClassic = Average(FastK(KLength), 3);
Shouldn't 3 be a parameter instead?

Not wanting to overwrite TS functions, I wrote my own *Stochastic. Is this
correct, or am I still confused?

Thanks,
Sanford Morton


{*
 *  *Stochastic -- to correct an error in TS2000i's Stochastic Classic
 *}

Input: Length(5), KAdjust(3),  DAdjust(3), OverBought(80), OverSold(20);
Variables: PercentK(0), PercentD(0);

PercentK = Average(FastK(Length), KAdjust);
PercentD= Average(Average(FastK(Length), KAdjust), DAdjust);

IF CurrentBar > Length Then Begin
  Plot1(PercentK, "%K");
  Plot2(PercentD, "%D");
End;

Plot3(OverBought, "OverBought");
Plot4(OverSold, "OverSold");