Hi,

I am a systematic mechanical trader (almost exclusively forex). For the last 
couple of years I have been using MT4 to code and backtest my systems, but I am 
at the point where I need a lot more than what the MT4 backtester can offer. 
After looking at different options it appears that Amibroker is just what I am 
looking for, especially  because of the execution speed, the possibility of 
executing walk-forward tests (a must) and the integrated 3D graphics (not a 
must, but nice to have).

I have downloaded and installed the evaluation version and have spent a few 
hours familiarizing myself with the program interface and -especially- looking 
into AFL. Unfortunately, I am having difficulties understanding a number of 
things about the language, or more accurately, about the whole philosophy 
behind the execution/flow of the backtests (I am a pretty decent C programmer, 
not a professional but I have been using it for nearly 20 years now, and from 
time to time my job also requires that I program algorithms in MATLAB, so I am 
familiar enough with programming languages, all sorts of arrays and matrices... 
the syntax of AFL, or the language in itself are not a problem). 

The first and most important question is this: how does the backtester operate 
to go through the historical data? How is the flow of data controlled? As 
important as this is, I don't seem to be able to find this information in the 
manual (I am sure it is there, but I haven't been able to find any section that 
addresses this specifically; maybe I need to look better, but after a while I 
was just getting frustrated). Let me be more specific: for example in MT4 the 
whole thing is event-driven, a tick (real or generated) arrives with a price 
update and triggers the execution of your code. When the program reaches the 
end, it just waits for the next tick. Next tick arrives, triggers next 
execution... and so on and so forth. Now, the AFL manual makes it very clear 
that in Amibroker the data is structured in arrays and it looks like everything 
is bar-based, but I haven't seen much about the specifics. So, lets imagine 
that my whole set of historical data is just a long vector of bar data (ok, 
several vectors, with the open, close, high, low, timestamps... data). What 
happens during a backtest? Does the program assign static indexes to the bars 
and then just runs through them, executing the whole code for each bar? If that 
is the case, is the first -oldest- bar always the 0th one? Or does the 
numbering of the array change so that the 0th bar is always the bar being 
currently executed?

Assuming some of what I said above makes sense... when are the 
buy/sell/stoploss/takeprofit conditions checked? At the close of the bar? This 
is of course important for my systems, many of them are intraday and I need to 
know the level of granularity I will require from my data in order to obtain an 
accurate simulation.

I have a zillion more questions, but this is a good starting point. Well, one 
more: is there a tutorial that I have missed and that addresses this kind of 
general questions about program execution and structure?  

Thanks in advance for your help!

Reply via email to