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

Re: [amibroker] Random Walk Index functions



PureBytes Links

Trading Reference Links


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<A 
href="">http://www.amibroker.com
 
<BLOCKQUOTE 
>
----- Original Message ----- 
<DIV 
>From: 
John 
R 
To: <A title=amibroker@xxxxxxxxxxxxx 
href="">amibroker@xxxxxxxxxxxxxxx 
Sent: Saturday, June 30, 2001 1:59 
AM
Subject: Re: [amibroker] RandomWalk 
Index functions
TJ,Thanks for your explanation of AB calculation 
method.FYI I did some more testing on Metastock calculation method - 
it differsfrom AB slightly as follows:-Minimum value is 0 i.e. 
Negative values are set to 0.Uses a moving average of the ATR.TheATR 
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 
PMSubject: Re: [amibroker] Random Walk Index 
functionsHello,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 ispseudo-code not AFL):1. First partial RwiLoN and RwiHiN 
values are calculated when N changes fromminperiods to maxperiods(Ref 
- gives the value N periods back as in AFL, and ATR is Average TrueRange 
(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 exampleminperiods = 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 RwiLoAs you can see from the formulas given in (1) 
it may happen that the valueis negative, for examplein a strong 
downtrend RwiHiN for all specified N can be negative - currenthighs 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 correctionin 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  
----- 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 ofmy 
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.