No, you are making assumptions instead of reading the manual. AFL does NOT work on bar-by-bar basis. It works on WHOLE ARRAYS, unless you tell it NOT to do so by using a loop.
User's Guide: Understanding AFL: http://www.amibroker.com/guide/h_understandafl.html (THIS IS MUST READ FOR EVERYONE) =============================== Best regards, Tomasz Janeczko amibroker.com ----- Original Message ----- From: "sidhartha70" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Thursday, May 22, 2008 10:56 PM Subject: [amibroker] Re: General query about cumulating values for indicators > Mike, > > you seem to know your onions... While I'm here can I ask you another > question... > > Can you clear up for me exactly 'how' AFL executes it's code... > > When I say 'how', this is what I mean. Coming from C# world, it's > pretty clear that trading type software tends to work on a bar by bar > basis... i.e. you have an event driven call, of the like, > OnNewBar()... in that event call you place the code that you want > executed on each bar... > > It's not clear to me 'how' AFL is called. If I'm applying an > indicator, how many times is that indicator code called...?? > > The reason I ask is, generally the way AFL works with arrays seems > very efficient... until perhaps you start having to loop through > arrays as part of your code... for example, > > for(i=1;i<BarCount;i++) > { > Value9[i]=IIf(Value7[i]!=Value8[i],((Value6[i]-Value8[i])/(Value7[i]-Value8[i])-0.5)+0.5*Value9[i-1],Value9[i]); > Value9[i]=IIf(Value9[i]>0.9999,0.9999,Value9[i]); > Value9[i]=IIf(Value9[i]<-0.9999,-0.9999,Value9[i]); > Value10[i]=IIf(Value9[i]!=1,0.25*log((1+Value9[i])/(1-Value9[i]))+0.5*Value10[i-1],Value10[i]); > } > > I have recently added this code to one of my indicators and it does > seem very slow when scrolling through graphs. Perhaps my code is > inefficient...?? > > I'm running a beast of a machine here, so speed should not be an issue. > > If I can understand 'how' AFL excutes... it might help me understand > bottlenecks. > > Many Thanks > > > > --- In [email protected], "Mike" <[EMAIL PROTECTED]> wrote: >> >> Nope, you're not alone. >> >> The topic pops up, in one form or another, every couple of weeks or >> so. Sounds like you understand the concept now. >> >> Good luck. >> >> Mike >> >> --- In [email protected], "sidhartha70" <sidhartha70@> >> wrote: >> > >> > Thanks Mike. >> > >> > So it seems I'm not the only one coming from more 'traditional' >> > languages to struggle with this concept. >> > >> > The bottom line it seems is that you cannot recursively alter the >> > value of any array by referencing other values of that array... at >> > least not directly. >> > >> > >> > --- In [email protected], "Mike" <sfclimbers@> wrote: >> > > >> > > Read thread #122034 for a similar discussion, including >> explanation. >> > > >> > > Mike >> > > >> > > --- In [email protected], "sidhartha70" <sidhartha70@> >> > > wrote: >> > > > >> > > > Hi All, >> > > > >> > > > Can someone clear this up for me... I am simply trying to >> cumulate >> > > the >> > > > value of an array. My intial thoughts were to do something like >> the >> > > > following, >> > > > >> > > > Value1=0; >> > > > Value2=log(Close); >> > > > Value1=Ref(Value1,-1)+Value2; >> > > > >> > > > However, that doesn't seem to work... So I've ended up with, >> > > > >> > > > Value2=log(Close); >> > > > Value1=Cum(Value2); >> > > > >> > > > Which does seem to work. I can't see why the first doesn't. >> > > > >> > > > Can anyone explain...? Thanks >> > > > >> > > >> > >> > > > > ------------------------------------ > > 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 > > >
