{ Pretty Good trendiness oscillator  10/19/1999  M.Johnson }

{ 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(0), green(0), blue(0), violet(0) ;

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

if(BarNumber < 5) then begin
   { TradeStation wants degrees, not radians }
   orange = @Tangent(0.02199645 * (180.0 / 3.141592653)) ;
   yellow = close[1] + (black - high) ;
   PGtrend_osc = 0;
   blue = close ;
   violet = ((1+1)+1)+2+3+5+8+13+21+34 ; { Fibonacci series }
end
else 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) ;
   PGtrend_osc = (close - blue) / yellow ;
end ;
