>
> In answer to your questions... it sounds like you haven't fully grasped the
> main concept of AFL yet... i.e. that it operates on arrays.
>
Reading the rest of your post... it appears you are right.
> For example,
>
> Buy = 1;
>
> Sets every element of the Buy array to be 1.
> Now if you said,
>
> Buy = IIf (Cross (TimeNum(), 093000), True, False);
>
> This would set every element of the Buy array (no looping required) to a new
> value based on the outcome of IIf (Cross (TimeNum(), 093000), True, False);
> (the outcome of that is an array itself - not a number). In this case it
> would set every element to zero (false) except those where the current time
> cross 09.30 am...
>
> You just need to play around with it.
>
Aha... this example helps quite a bit. The script/program is applied
simultaneously to the whole array, not bar by bar. That was what I was missing.
Mmmm... the result (in purely numerical terms, not talking about speed) should
of course be the same whether the calculation is simultaneous or looped, but
the type of structure fed to the functions in the script (array vs. single
variable) is not. I guess that'll be the main difference when programming it.
Although if pretty much everything is an array in AFL, even that should be
nearly the same.
Ok, I'll have to get used to thinking this way when coding, but now I *think* I
understand that.
The next thing I wonder about are execution prices... if one of the arrays
taking care of order operations (buy/sell/short...) has a "1" for that bar, at
what price is the operation executed by the backtester? Always at the closing
price of the bar?
Thanks again for your patience :).