Hello, No. Ref is NOT the same as PREV.
Prev is usually used for RECURSIVE formulation, therefore LOOP must be used or AMA/AMA2 function Conversion to loop is pretty straightforward. 1. Create standard loop 2. define temporary variables for PREV "emulation" 3. Re-type the MS line with CC instead of C and IIF instead of IF, If((C*.97)>PREV,C*.97,If((C*1.03)<PREV,C*1.03,PREV)) to: result = 0; for( i = 1; i < BarCount; i++ ) { PREV = result[ i - 1 ]; CC = C[ i ]; result[ i ] = IIf( (CC*0.97) > PREV, CC*0.97, IIf((CC*1.03) < PREV, CC*1.03, PREV)); } It is longer than MS code but... advantage is that it runs 100 times faster. Best regards, Tomasz Janeczko amibroker.com ----- Original Message ----- From: "gmorlosky" <[EMAIL PROTECTED]> To: <amibroker@yahoogroups.com> Sent: Wednesday, May 28, 2008 10:35 PM Subject: [amibroker] Re: Convert Metastock indicator with PREV function into AFL > If your mean PREV is the bar one day agao, then replace all PREV with > Ref(C,-1) > > --- In amibroker@yahoogroups.com, "loshude8888" <[EMAIL PROTECTED]> wrote: >> >> Dear Members, >> Plz reply. >> >> Lokesh >> >> >> --- In amibroker@yahoogroups.com, "loshude8888" <shublok@> wrote: >> > >> > Dear Members, >> > >> > Following is a METASTOCK indicator, how can we write this >> indicator >> > into AFL? >> > >> > If((C*.97)>PREV,C*.97,If((C*1.03)<PREV,C*1.03,PREV)) >> > >> > Thanks in advance. >> > >> > Regards, >> > Lokesh >> > >> > > > > ------------------------------------ > > Please note that this group is for discussion between users only. > > To get support from AmiBroker please send an e-mail directly to > SUPPORT {at} amibroker.com > > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: > http://www.amibroker.com/devlog/ > > For other support material please check also: > http://www.amibroker.com/support.html > Yahoo! Groups Links > > >