PureBytes Links
Trading Reference Links
|
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" <gmorlosky@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxxx, "loshude8888" <shublok@xxx> wrote:
>>
>> Dear Members,
>> Plz reply.
>>
>> Lokesh
>>
>>
>> --- In amibroker@xxxxxxxxxxxxxxx, "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
>
>
>
------------------------------------
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
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|