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

Re: [amibroker] Random Walk Index functions



PureBytes Links

Trading Reference Links

Hi Tj,

I realise ATR is already an average. I don't know why the MS formula takes
average again of ATR - I am just reporting what I discovered FYI.

I agree with you that a floor value of zero seems wrong. The 1 day offset on
ATR was apparently suggested by originator (M.Poulos) - presumably his work
indicated it gave better results. I have seen this offset used in RWI
formulas in other TA software e.g. Technifilter.

In practice I doubt whether these variations would make much difference - I
just get curious when different programs report different values for same
indicator!

Regards
John

----- Original Message -----
From: "Tomasz Janeczko" <tj@xxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Saturday, June 30, 2001 10:37 AM
Subject: Re: [amibroker] Random Walk Index functions


Hi John,

Actually ATR( N) is a *moving average* of true ranges over the N bars.
The only difference is that ATR uses Wilders averaging:

ATR( N ) = Wilders( TrueRange, N ) = Wilders( ATR( 1 ), N );

--
I have found no reasons why should we do Ref( ATR, -1 ) stuff and
does not allow negative values. Do you know of any reasons
why MS does it?

Best regards,
Tomasz Janeczko
------------------------------------------------
AmiBroker - the comprehensive share manager
http://www.amibroker.com

----- Original Message -----
From: John R
To: amibroker@xxxxxxxxxxxxxxx
Sent: Saturday, June 30, 2001 1:59 AM
Subject: Re: [amibroker] Random Walk Index functions


TJ,

Thanks for your explanation of AB calculation method.

FYI I did some more testing on Metastock calculation method - it differs
from AB slightly as follows:-

Minimum value is 0 i.e. Negative values are set to 0.
Uses a moving average of the ATR.
The ATR moving average is offest by 1 day (apparently recommened by
Poulos).

So MS code for RWIHiN is:-

RwiHiN = ( High - Ref( Low, -N ) ) / ( ref( mov(ATR(1),N,S),-1) * SQRT(
N ) );

John

----- Original Message -----
From: "Tomasz Janeczko" <tj@xxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Friday, June 29, 2001 2:54 PM
Subject: Re: [amibroker] Random Walk Index functions


Hello,

RWILO SYNTAX rwilo( minperiods, maxperiods )
RETURNS ARRAY
FUNCTION Calculates the Random Walk Index from Lows.
EXAMPLE rwilo( 9, 40 );


RwiHi and RwiLo functions in AmiBroker are calculated as follows (this is
pseudo-code not AFL):

1. First partial RwiLoN and RwiHiN values are calculated when N changes
from
minperiods to maxperiods
(Ref - gives the value N periods back as in AFL, and ATR is Average True
Range (as in AFL) and SQRT is a square root function )

RwiHiN = ( High - Ref( Low, -N ) ) / ( ATR( N ) * SQRT( N ) );
RwiLoN = ( Ref( High, -N ) - Low ) / ( ATR( N ) * SQRT( N ) );

2. Then the maximum of calculated values are taken (in this example
minperiods = 10; maxperiods = 15 )

RwiHi( 10, 15 ) = max( RwiHi10, RwiHi11, RwiHi12, RwiHi13, RwiHi14,
RwiHi15 );
RwiLo( 10, 15 ) = max( RwiLo10, RwiLo11, RwiLo12, RwiLo13, RwiLo14,
RwiLo15 );

3. Rwi oscillator is a difference between RwiHi and RwiLo

As you can see from the formulas given in (1) it may happen that the value
is negative, for example
in a strong downtrend RwiHiN for all specified N can be negative - current
highs are lower than Lows N periods ago.

Metastock obviously adds something like that:

RwiHi = Max( RwiHi, 0 );
RwiLo = Max( RwiLo, 0 );

essentially not allowing negative values at all. I doubt if this is
correct.
But you may use this correction
in your code:

MSrwilo = Max( RWILo( 8, 20 ), 0 );
MSrwihi = Max( RWIHi( 8, 20 ), 0 );


Best regards,
Tomasz Janeczko
===============
AmiBroker - the comprehensive share manager.
http://www.amibroker.com

----- Original Message -----
From: John R
To: amibroker@xxxxxxxxxxxxxxx
Sent: Wednesday, June 27, 2001 3:40 PM
Subject: [amibroker] Random Walk Index functions


Tomasz,

When converting some of my systems from Metastock I noticed that the
Amibroker RWI functions RWIHI and RWILO can return negative values
whereas
the Metastock equivalents never fall below 0.

Is there a problem here or is it down to different interpretations of
the
Michael Poulos work? Could you let me know the formula AB uses for these
functions.

Thanks
John



Yahoo! Groups Sponsor



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.




Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.