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

RE: [amibroker] equivalent of PREV



PureBytes Links

Trading Reference Links

Check out the AMA() function:
 

// PREV

Z =(A*B)+(C*PREV);

can be written in AFL as:

Z = AMA2( A(array), B, C );

also:

xx = FactorA * Close + (FactorB * PREV(xx)); // metastock

translates to:

xx = AMA2( Close, FactorA, FactorB );

-----Original Message-----
From: Zeno [mailto:lars.oppermann@xxxxxxxx]
Sent: Monday, January 10, 2005 5:11 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] equivalent of PREV


Hi,

is there an equivalent to MetaStock's PREV variable, which allows to
reverence an earlier value of an array while it is being defined? Or
what would be the apropriate AFL concept to achive a similar behaviour?

E.g.:
I'd like to calculate  Heikin Ashi O/C/H/L values. HAOpen for instance
is defined as
HaClose(t) = (O+H+L+C)/4;
HaOpen(t) = (HaOpen(t-1) + HaClose(t-1))/2;

using Ref(HaOpen,-1) does not work, since HaOpen is undefined at this
time, Ref(HaClose,-1) is fine, since it was defined previously.

In MetaStock, one would write:
HaOpen:=(PREV + Ref(HaOpen,-1)/2;

What's the right way to do this in AFL?

Thanks for your support.
~Lars





Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html




Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html




Yahoo! Groups Links