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

Re: [amibroker] Random Walk Index functions



PureBytes Links

Trading Reference Links


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 valuesare 
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.<A 
href="">http://www.amibroker.com
<BLOCKQUOTE 
>
----- Original Message ----- 
<DIV 
>From: 
John 
R 
To: <A title=amibroker@xxxxxxxxxxxxx 
href="">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 theAmibroker RWI functions RWIHI and RWILO can 
return negative values whereasthe Metastock equivalents never fall below 
0.Is there a problem here or is it down to different interpretations 
of theMichael Poulos work? Could you let me know the formula AB uses for 
thesefunctions.ThanksJohnYour 
use of Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service.