Hi again - just had another look at your question, I notice that you just refer to "processing arrays". You picked an example that uses looping but you can wrap any AFL in a function, you don't need to use looping unless you really need it...Thnk of the function as sort of a container - it will basically hold any code that you could just as easily put inline, not much reason to use one I don't think unless you want to call the code from several places or it is part of some larger organizational scheme...
Steve ----- Original Message ----- From: "Steve Dugas" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Saturday, August 09, 2008 7:18 PM Subject: Re: [amibroker] Using Functions to Process Arrays > Hi - Don't know of any tutorial but not sure you really need one. Do you > understand basic looping already? You could start with any inline looping > code. Once you have that working and understand it, you can just wrap it > in > a function and pass it the arrays it needs via the function args. Also, > make > sure the function is defined before it is called. I believe there are a > couple of of looping tutorials in the files section, I wrote a very brief > one and I think it was GP that wrote a better one. If you have something > you > can't get to work, feel free to post it... > > Steve > > ----- Original Message ----- > From: "Pete" <[EMAIL PROTECTED]> > To: <[email protected]> > Sent: Saturday, August 09, 2008 6:37 PM > Subject: [amibroker] Using Functions to Process Arrays > > >>I have a bit of experience with building functions in VBA so I get the >> basic concept. But the projects I've built in the past did not rely >> heavily on processing arrays within functions. What I would really >> like is to get my brain around this so I understand exactly what's >> taking place and, hopefully, to better apply this technique to my AFL >> coding. >> From the AB help files: >> I simple function for a second order smoother: >> //begin code ************************************ >> function IIR2( input, f0, f1, f2 ) >> { >> result[ 0 ] = input[ 0 ]; >> result[ 1 ] = input[ 1 ]; >> >> for( i = 2; i < BarCount; i++ ) >> { >> result[ i ] = f0 * input[ i ] + >> f1 * result[ i - 1 ] + >> f2 * result[ i - 2 ]; >> } >> >> return result; >> } >> //end code *************************************** >> >> Do any of you know where I can get a quick and easy tutorial on >> processing arrays in functions so I can better understand how this >> looping works? >> >> Pete :-) >> >> >> ------------------------------------ >> >> 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 > > > >
