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

Re: [amibroker] Re: Tomasz - Psuedo Code for RWI - Random Walk Index (and or RWIhi/lo etc.)



PureBytes Links

Trading Reference Links


I concur that the results do not agree between AB 
and MS computations.  I would certainly expect Tomasz to use the 
conventional TR.  I looked at the results on !RUT and !SPX - which 
have almost NO gaps, i.e. the range always includes the close, hence the TR= 
H-L almost everywhere and the results also are inconsistent.
 
//atr testGraph2 = 
ATR(<FONT 
color=#ff00ff size=1>1)-(H-L)<FONT 
color=#008000 size=1>;
 
Tis a puzzlement.  At any rate, the random 
walk stuff is simply a comparison of price vs. sqrt(n)*delta where all the play 
comes from the choice of the random step size, delta.
 
I presume AB allows a range for the selection of 
the maximum excursion from gaussian spreading.
 
Cheers,
 
Richard
<BLOCKQUOTE 
>
----- Original Message ----- 
<DIV 
>From: 
<A title=nenapacwanfr@xxxx 
href="">nenapacwanfr 
To: <A title=amibroker@xxxxxxxxxx 
href="">amibroker@xxxxxxxxxxxxxxx 
Sent: Tuesday, July 02, 2002 10:51 
AM
Subject: [amibroker] Re: Tomasz - Psuedo 
Code for RWI - Random Walk Index (and or RWIhi/lo etc.)
Richard,for example in Mstock the RWIL(2,9) isthe 
formula belowyou'll see that Mstock uses the ATR or the true range ofone 
day 
TR=Max(Max(H-Ref(C,-1),Ref(C,-1)-L),H-L);//Plot(TR,"",5,1);//Plot(ATR(1),"",2,1);and 
oofset by one day the simple average of the ATRBUT if I compare with 
the AMIBROKER RWI, that 's 
differentPlot(RWILo(2,9),"",1,1);Plot(avgRWIL,"",2,1);I wonder 
what TRUE RANGE Tomacz uses in the computation of random 
walkavgRWIL=/* formule Mstock*/Max( ( Ref(High,-1) - 
Low ) / ( ( Ref(MA(ATR( 1 ) ,2 ),-1)) * sqrt( 2 ) ) ,Max( 
(Ref(High,-2) -Low) / ( ( Ref(MA(ATR( 1 ),3),-1)) * sqrt( 3 ) ), Max( 
(Ref(High,-3) - Low) / ( (Ref(MA(ATR( 1 ) ,4) ,-1)) * sqrt( 4 ) ) , 
Max( ( Ref( High,-4) - Low) / ( (Ref(MA(ATR( 1 ),5),-1)) * sqrt( 5 ) 
), Max( (Ref(High,-5) - Low) / ( (Ref( MA( ATR( 1 ),6),-1) ) * sqrt( 6 
) ), Max( ( Ref(High,-6) -Low) / ( (Ref( MA( ATR( 1 ),7),-1)) * sqrt( 
7 ) ), Max((Ref(High,-7)-Low) / ( (Ref(MA(ATR( 1 ),8),-1)) * sqrt(8) 
), (Ref(High,-8)-Low) / ( (Ref(MA(ATR(1),9),-1)) * sqrt( 9 ) ) ) ) ) ) 
) ) );> Thanks Stephane, I think the concept is becoming 
clear, it is the implementation that is confusing me at the 
present.   The simplest description I have located is> 
> ATR = Average Trading Range> RWI high = (HI - LO[n]) / ATR * n 
sqrt(n)> RWI low = (HI[n] - LO) / ATR * n sqrt(n)> > 
There are several implementation choices - which ATR do you use, today's, 
last n days, max of last n days, etc.  It appears that the common 
MetaStock may use n*max(TR(n)), n = 1> > however, the AB code 
has two parameters,>       SYNTAX  
rwi( minperiods, maxperiods ) >       
RETURNS ARRAY >       FUNCTION  
Calculates the Random Walk Index indicator as a difference between Random 
Walk Index from Highs (RWIHI() function) and Random Walk Index from Lows 
(RWILO() function. >       EXAMPLE rwi( 
9, 40 ); > > > and I am not certain what the min/max 
periods refer to.  They may be the range over which the statistics 
are generated, although that still hold some ambiguity in my mind?> 
> > May have to wait for clarification from TJ. I have attached 
some test AFL indicator code for those interested.> > 
Thanks,> > Richard> >   ----- Original 
Message ----- >   From: nenapacwanfr >   To: 
amibroker@xxxx >   Sent: Tuesday, July 02, 2002 12:22 
AM>   Subject: [amibroker] Re: RWI - Random Walk 
Index> > >   Richard,>   I 
have a description in a book ( at the period when I have tried 
>   technifilter)> >   if we usethe 
average true range over 4 days to quantify what a >   normal 
step size would be, then we would expect random movement to 
>   be within 2 times the av true range, which is the square 
root of >   four times the step size.>   if 
the traveled distance is more than this number, then the price 
>   has moved more than we would expect from random 
movement.>   therefore the movement is probably not 
random.>   it is how works RWI comparing actual price 
displacement to expected >   displacement for random 
moves.> > >   I can copy more if you want ( 
short term formula; long term formula)>   
stephane> > > > >   > Ran 
across the AB functions RWI(min,max) etc. and I have been >   
unable to>   > locate a mathematical description or 
motivation (or intelligible >   
code).>   > >   > Apparently, RWIwas 
presented by Michael Poulos in the Jan 92, >   TASC: 
Random>   > Walk was defined in Technical Analysis Of 
Stocks and Commodities >   by Michael>   
> Poulos (see TASC, January 1992 and September 1992). Random Walk 
>   calculates>   > how much price should 
move over a given period if its movement >   were 
purely>   > random. When price moves past this level,it 
can be assumed to be >   trending>   
> in that direction and the system will issue a signal. The maximum 
>   look-back>   > period for RandomWalk 
is optimizable in this system. An excellent >   
system.>   > >   > Sounds interesting, 
however, I cannot ferret out the significance >   of 
the>   > min/max parameters.  BTW I can locate 
several metastock listings, >   and 
an>   > easy language listing - neither help me 
much.>   > >   > >   
> Can anyone suggest a reference?>   > 
>   > Cheers,>   > 
>   > Richard> > 
>         Yahoo! Groups Sponsor 
>               
ADVERTISEMENT>              
>        > 
>   Your use of Yahoo! Groups is subject to the Yahoo! Terms 
of Service.Your 
use of Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service.