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

Re: Oscillators



PureBytes Links

Trading Reference Links

> As you are probably aware N&M Smith has posted some ELA code for
> this oscillator.  However, I have only be able to get the two
> functions to verify in TS2000i Power Editor.  In the indicator
> Power Editor does not recognize the term "OscLen".  Also, I doubt
> that the two statements "Plot2 LowBand and Plot3 HiBand" will
> verify because there isn't any reference to identify what LowBand
> and HiBand is. 

OscLen, HiBand, and LowBand are just inputs the indicator.  The ELA 
that N&M Smith posted showed that more clearly than his pasted-in 
text.  I suspect that's because he pasted it in from the Quick editor.

Here is a somewhat simplified version of the indicator.  I felt the 
HighestSoFar & LowestSoFar functions were obscuring the logic of the 
code more than they were helping, and they also required a lot of 
duplicated calls to FastK, so I folded it all into the indicator.

This code produces exactly the same results as the indicator & 
functions posted by N&M Smith.

The indicator looks at the range of AvgFastK (calculated as 
average(FastK(OscLen),OscLen)) that has been seen so far, and uses 
the midpoint of those AvgFastK values as a "base."  Then to that 
"base" value it adds AvgFastK-average(AvgFastK,MALen), which is a 
measure of how fast AvgFastK is changing.  If AvgFastK isn't changing 
at all, the indicator returns the "base" value, which will probably 
be somewhere close to 50.  If AvgFastK is increasing quickly, 
Dynamo_Q returns a value higher than 50, and vice versa.  

The Dynamo_Q result is quite a bit cleaner and smoother than an 
equivalent-length FastK, but it still suffers from the same sorts of 
problems as FastK -- giving sell signals in a roaring uptrend, etc.  
I'd say it's definitely better than a simple FastK, though.

BTW, the CheckAlert code is a bit funky.  Among its other tests it 
checks for HighBand crossing over/under LowBand --  not very likely !!

Gary

===========

Input: OscLen(10),MALen(20),LowBand(23),HiBand(77);

Vars: AvgFastK(0), LowestSoFar(0), HighestSoFar(0);

AvgFastK = Average(FastK(OscLen),OscLen);

if barnumber = 1 then begin
   LowestSoFar = AvgFastK;
   HighestSoFar = AvgFastK;
   end 
else begin
   if AvgFastK < LowestSoFar then LowestSoFar = AvgFastK;
   if AvgFastK > HighestSoFar then HighestSoFar = AvgFastK;
   end;

Plot1(((LowestSoFar+HighestSoFar)/2) 
       + (AvgFastK-Average(AvgFastK,MALen)),"Plot1");
Plot2(LowBand,"Plot2");
Plot3(HiBand,"Plot3");

if CheckAlert Then Begin
  if Plot1 Crosses Above Plot2 or Plot1 Crosses Below Plot2
     or Plot1 Crosses Above Plot3 or Plot1 Crosses Below Plot3
     or Plot2 Crosses Above Plot3 or Plot2 Crosses Below Plot3
    then Alert = TRUE;
  end;

==========================

FWIW, you can get almost exactly the same results by getting rid of 
the "Highest/LowestSoFar" code and just using 50 as the "base" value:

==========================

Input: OscLen(10),MALen(20),LowBand(23),HiBand(77);

Vars: AvgFastK(0);

AvgFastK = Average(FastK(OscLen),OscLen);

Plot1(50 + (AvgFastK-Average(AvgFastK,MALen)),"Plot1");
Plot2(LowBand,"Plot2");
Plot3(HiBand,"Plot3");