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

Ehlers "Smooth" Function



PureBytes Links

Trading Reference Links

Same story with the Ehlers "Smooth" function code from "Optimal Detrending", by John F. Ehlers in the July, 2000 issue of TASC.

It also used an uninitialized variable and the output on the initial bar was zero rather than the price, as it should have been. 

Thought I would post the revised code for that also. 

Bob Fulks

{ *******************************************************************

   Function      :    Ehlers.Smooth
   
   Last Edit     :    7/1/2000

   Provided By   :    Bob Fulks

   Description   :    
      This function is from "Optimal Detrending", by John F. Ehlers 
      in the July, 2000 issue of TASC.   It is revised to properly 
      initialize the value to eliminate errors in the initial bars.
   
   Inputs:

      Price: Price series to be smoothed.


********************************************************************}

Inputs: Price(NumericSeries);
Vars: Ave(Price);

Ave = 0.13785 * (2 * Price - Price[1]) 
    + 0.0007  * (2 * Price[1] - Price[2]) 
    + 0.13785 * (2 * Price[2] - Price[3]) 
    + 1.2103  * Ave[1] 
    - 0.4867  * Ave[2];

Ehlers.Smooth = Ave;


{ *******************************************************************

   Indicator     :    Ehlers.Smooth
   
   Last Edit     :    7/1/2000

   Provided By   :    Bob Fulks

   Description   :    Plots the Ehlers.Smooth function.
   
   Inputs:

      Price: Price series to be smoothed. 


********************************************************************}

Input: Price(MedianPrice);

Plot1(Ehlers.Smooth(Price), "Smooth");
Attachment Converted: "f:\eudora\attach\SMOOTH.ELA"