PureBytes Links
Trading Reference Links
|
If PREV works only on C in the example, wouldn't this run faster than using a loop in AFL? Z =(A*B)+(C*Ref(C,-1)); Unless something has changed in the latest AFL releases Tomasz's array processing is much faster than using loops to perform the same function in AFL.
Barry
--- In amibroker@xxxxxxxxxxxxxxx, Thomas Ludwig <Thomas.Ludwig@xxx> wrote:
>
> Hello,
>
> TJ once wrote:
>
> [quote]
> Hello,
>
> PREV in MS is needed because MS does NOT have looping.
>
> In AB, there are loop constructs so there is no need for PREV
> because loops give faster and more general way of solving coding problems.
>
> Since loops are more general they allow easy translation of every
> case where MS needs PREV.
>
> Statment like this:
> Z =(A*B)+(C*PREV);
>
> Using loop looks as follows:
>
> z = 0; // initialize
> for( i = 1; i < BarCount; i++ )
> {
> prev = Z[ i - 1 ]; // PREV is previous value of Z.
> Z[ i ] = A[ i ] * B[ i ] + C[ i ] * prev;
> }
>
> As you can see the statement is identical with the exception that
> AFL looping code uses [ ] operator to access individual array elements.
>
> Good thing is that AFL looping code is BarCount-times faster than MS code.
> Since 5 years of EOD data is 1300 bars, AFL looping code is 1300 times faster
> than MS in that case.
>
> It is also possible to use AMA/AMA2 instead of PREV:
>
> Z = AMA2( A, B, C );
>
> which is shorter but AMA is less general than looping code.
> [/quote]
>
> HTH
>
> Greetings,
>
> Thomas
>
>
> On 15.06.2009, 13:06:00 Mubashar virk wrote:
> > Hi all,
> >
> > Has any one worked out a universal AFL Function = the perversity in
> > MetaStock that is called PREV.
> >
> > Thanks
>
------------------------------------
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
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/
|