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

Re: PGTrend for TS2000



PureBytes Links

Trading Reference Links

At 12:14 PM -0700 10/25/99, ROBERT ROESKE wrote:

>This is one cool piece of software Mark Johnson provided.  It does a neat
>job of detecting trend versus congestion.  Even though his intent was to
>create one code fits all, I would suggest some changes.  In the Function
>PGtrend_osc I would change the violet length variable to a numericsimple
>input.  You could still assign a fibo number or sum of fibo numbers to it as
>in his fixed code.  Then in the PG_osc_sys1 I would make the buy and sell
>thresholds inputs as well as the "violet" an input.  Then you can adjust the
>congestion threshold(or noise band) for different sensitivity  as well as
>the "fibonacci" lookback time periods.

Mark Jurik posted a simplified version of this code earlier.

I have made the parameters inputs in the version below. With the 
defaults shown, this code does exactly the same thing as the original 
code. (Make sure the MaxBarsBack setting is 92 for both systems.)

The simpler code makes it easy to see what is actually happening.

Since the term:

     Average(Close, Length1)

lags the Close by ((Length1 - 1) / 2) bars, this term is positive 
when the trend is up. This is basically the usual moving average 
crossover system with three important differences:

   > The short average of the moving average crossover system is
     replaced by the unaveraged Close

   > There is a dead band in the middle to help eliminate the usual
     whipsaws of a moving average crossover system

   > The dead band is adaptively adjusted by the volatility of the market

To understand this we need to rearrange the terms a little.

Restating the equation for the buy point in a little simpler notation:

    Close - (AverageClose) / (XAverageTrueRange) > 3

Rearranging:

    Close - (AverageClose) > 3 * (XAverageTrueRange)

so the size of the dead band is directly proportional to the volatility.

By comparison, the usual moving average crossover system buy point 
can be written as:

    ShortAverageClose - (LongAverageClose) > 0

So the dead band makes it harder to enter by a self-adjusting amount, 
eliminating a lot of the whipsaws.

Interesting system.

Bob Fulks



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

Input: EntLevel(3), ExLevel(0), Length1(89), Length2(89.9090);
Vars:  MP(0), Osc(0);

MP = MarketPosition;

Osc = (Close - Average(Close, Length1)) / XAverage (TrueRange, Length2);

if MP < 1 and Osc > +EntLevel then Buy        at market ;
if MP = 1 and Osc < +ExLevel  then ExitLong   at market ;
if MP >-1 and Osc < -EntLevel then Sell       at market ;
if MP =-1 and Osc > -ExLevel  then ExitShort  at market ;

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