Since version 2.5, AmiBroker features automatic technical analysis tools. AmiBroker can check for user-defined buy/sell conditions, giving you an idea about the current situation on the market. It can also perform a system test (simulation), telling you about the performance of your trading system. Version 3.0 of AmiBroker introduced a new formula language (AFL), allowing you to write not only system tests but also custom indicators and guru advisor commentaries.
In order to do this, you have to define buy and sell rules, indicator formulas, or commentaries using a special AmiBroker Formula Language (AFL), which is described below. For more information about using analysis tools, see also the description of the Automatic Analysis window, Formula Editor, and Commentary window in Chapter 2.
AFL is used for defining your trading rules and explorations in the Automatic Analysis window, custom commentaries in the Guru Commentary window, and indicator formulas in the Formula Editor window.
A detailed reference of the AFL language is given here.
Below you will find some simple buy and sell rules. They are just formal equivalents of some of the most common indicators' interpretation rules. You can treat them as a starting point for developing your own trading strategies, but before you get too excited when you think you've found the "holy grail" of trading systems, check the following:
buy = cross( macd(), 0 );
sell = cross( 0, macd() );
buy = cross( ema( close, 9 ), ema( close, 15 ) );
sell = cross( ema( close, 15 ), ema( close, 9 ) );
buy = cross( rsi(), 30 );
sell = cross( 70, rsi() );
buy = cross( ultimate(), 50 );
sell = cross( 50, ultimate() );
The Automatic Analysis window enables you to check your quotations against defined buy/sell rules. AmiBroker can produce a report telling you whether buy/sell signals occurred on a given symbol in the specified period. It can also simulate trading, giving you an idea about the performance of your system.
In the upper part of the window, you can see a text entry field. In this field, you should enter buy and sell rules. These rules are assignment statements written in AmiBroker's own language. You can find the description of this language in the AFL reference guide.
In order to make things work, you should write two assignment statements (one for a buy rule, the second for the sell rule), for example:
buy = cross( macd(), 0 );
sell = cross( 0, macd() );
The Automatic Analysis window also allows you to optimize your trading system and perform in-depth explorations.
See also: a detailed description of the Automatic Analysis window controls
The Formula Editor allows you to write formulas to be used as indicators or in
the Automatic Analysis window. More on this
here.
The Commentary window enables you to view textual descriptions of the actual technical
situation on a given market.
Commentaries are generated using formulas written in AmiBroker's own formula
language. You can find the description of this language in AmiBroker
Formula Language Reference Guide.
Moreover, the Commentary feature also gives you a graphical representation of buy & sell signals by placing the marks (arrows) on the price chart.
NOTE: Using complex commentary formulas, you may observe long execution times.
See also: a detailed description of the Guru Advisor Commentary window controls