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

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



PureBytes Links

Trading Reference Links

Hello,

AmiBroker uses a standard ATR as described in:
http://stockcharts.com/education/Resources/Glossary/ATR.html

But the formula is different it uses not ATR(1) always but ATR(n) 
where n changes from min to max.

Best regards,
Tomasz Janeczko
amibroker.com

--- In amibroker@xxxx, "nenapacwanfr" <nenapacwanfr@xxxx> wrote:
> Richard,
> 
> for example in Mstock the RWIL(2,9) is the formula below
> you'll see that Mstock uses the ATR or the true range of one 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 ATR
> 
> BUT if I compare with the AMIBROKER RWI, that 's different
> Plot(RWILo(2,9),"",1,1);
> Plot(avgRWIL,"",2,1);
> 
> I wonder what TRUE RANGE Tomacz uses in the computation of random 
> walk
> 
> 
> 
> avgRWIL=/* 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 use the 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, RWI was 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 Random Walk 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.