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

RE: CQG version of Stochastics



PureBytes Links

Trading Reference Links


John Clemens wrote, "I have tried to duplicate it in TS4 but none 
of the various versions of slow stochastics that I have will match it."

John: If you apply a 'take-off' style moving average, the jagged lines
smooth out fairly well. Here is some code with a couple of switches
so you have a choice of what you want displayed (nice when you want
to lay Stochastics over prices).

Steve...

{Sto-KDS uses Take-Off Moving Average  11/99 S.Gibson}

Input: Klen(5), Dlen(4), SDlen(2),
       ShowD(False), {turn on %D?}
       ShowLvls(False); {show 20/80?}

Vars: PerK(0), PerD(0), SloD(0);

If CurrentBar = Klen then Begin
   PerK = FastK(Klen);
   PerD = PerK;
   SloD = PerK;
End;

If CurrentBar > Klen then Begin
   PerK = FastK(Klen);
   PerD = (( PerD[1] * (Dlen-1)) + Perk)/ Dlen;
   SloD = (( SloD[1] * (SDlen-1)) + PerD)/ SDlen;

   If ShowD = TRUE then Plot1( PerD, "%D");

   Plot2( SloD, "SD");  {always}

   If ShowLvls = TRUE then begin
      Plot3( 80,"");
      Plot4( 20,"");
   End;
End;