[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,
 
Thank you for your detailed investigation. 
 
I pointed out the ATR because you said that
Metastock uses simple moving average of ATR(1). ATR(1) means 
no wilders
averaging and is equivalent to simply true range function. So 
simply  Wilders average 
(ATR) is replaced by simple moving average. 
 
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 12:32 
PM
Subject: Re: [amibroker] RandomWalk 
Index functions
Hi Tj,I realise ATR is already an average. I don't 
know why the MS formula takesaverage 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 onATR was apparently suggested by 
originator (M.Poulos) - presumably his workindicated it gave better 
results. I have seen this offset used in RWIformulas in other TA software 
e.g. Technifilter.In practice I doubt whether these variations would 
make much difference - Ijust get curious when different programs report 
different values for sameindicator!RegardsJohn----- 
Original Message -----From: "Tomasz Janeczko" 
<tj@xxxx>To: <amibroker@xxxxxxxxxxxxxxx>Sent: 
Saturday, June 30, 2001 10:37 AMSubject: Re: [amibroker] Random Walk Index 
functionsHi 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 
anddoes not allow negative values. Do you know of any reasonswhy MS 
does it?Best regards,Tomasz 
Janeczko------------------------------------------------AmiBroker- 
the comprehensive share manager<A 
href="">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 explanationof 
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 byPoulos).  
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 changesfrom  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 iscorrect.  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    
----- 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 valueswhereas    
the Metastock equivalents never fall below 0.    Is 
there a problem here or is it down to different interpretations 
ofthe    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.Your use of Yahoo! Groups is subjectto 
the Yahoo! Terms of 
Service.