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

Re: PGTrend for TS2000



PureBytes Links

Trading Reference Links

>
>  Interesting situation. I tested both systems (M. Johnson's original post
>and M. Jurik's update) across 25 different markets and there was a "sizeable"
>difference in the results. I'm not sure why. Any comments?


There are differences in the initialization. Many of the variables 
used in the original are not initialized properly so there were 
transients at the first bar. Since the averaging time is long, it 
takes a lot of bars for the original version to stabilize. By 
plotting both, you can see differences that last perhaps a hundred 
bars or more.

This would make the initial trades of the two versions somewhat 
different. If you are using a lot of bars the differences would be 
very small.

By initializing the original as noted in the code below it's value is 
identical to

    Osc = (Close - Average(Close, 89)) / XAverage (TrueRange, 89.90909);

for all bars.

Bob Fulks



{ *******************************************************************
 
    Function:    PGtrend2
 
    Last Edit:   10/26/99

    Coded By:    Bob Fulks

    Description: A revision of Mark Johnson's PGtrend function
                 with the initialization changed.

********************************************************************}
{ Pretty Good trendiness oscillator  10/19/1999  M.Johnson-Omega List}

{ Strong uptrend      if osc > +3.0            }
{ Strong downtrend    if osc < -3.0            }
{ Trend is over       if osc crosses thru 0.0  }

vars:    black(0), brown(0), red(0), orange(0),
          yellow(TrueRange), green(0), blue(close), violet(0) ;

black = 2.0 * (high - close[1]) ;
brown = high + high - (low + low) ;
red   = (close[1] - low) / 0.5 ;

if(BarNumber <= 1 ) then begin
    { TradeStation wants degrees, not radians }
    orange = @Tangent(0.02199645 * (180.0 / 3.141592653)) ; {0.022}
    yellow = close[1] + (black - high) ;
    blue = close ;
    violet = ((1+1)+1)+2+3+5+8+13+21+34 ; { Fibonacci series }
end;
begin
    green = black ;
    if(brown > green) then green = brown ;
    if(red > green) then green = red ;
    yellow = yellow[1] + (orange * ((green/2) - yellow[1])) ;
    blue = Average(Close, violet) ;
    PGtrend2_osc = (close - blue) / yellow ;
end ;