Automatic analysis window

Automatic analysis window enables you to check your quotations against defined buy/sell rules. AmiBroker can produce report telling you if buy/sell signals occurred on given symbol in the specified period of time. It can also simulate trading, giving you an idea about performance of your system.

In the upper part of window you can see the path to the formula used along with Pick and Edit buttons.

Pick button opens up a file dialog that allows you to choose the formula you want to use for the analysis.

Edit button opens up the AFL Formula Editor that allows you to edit currently selected formula.

If you want to create new formula just open Formula Editor directly from Tools->Formula Editor menu, type the formula and press Analysis button in the Formula Editor toolbar.

In the formula editor you need to write the code that specifies either scan/exploration you want to run or a trading system you want to back test. You can find the description of this language in AFL reference guide.

In order to make things work you should write two assignment statements (one for buy rule, second for the sell rule), for example:

buy = cross( macd(), 0 );
sell = cross( 0, macd() );

Below these fields there are several controls for setting:

  1. To which symbol(s) analysis should be applied.
    You can select here all symbols, only currently selected symbol (selected in Select Window) or custom filter setting
  2. Time range of analysis
    analysis can be applied to all available quotations or only to the defined number of most recent quotations (or days) or to a date range (from/to)

In the lower part of the analysis window you can see 4 buttons:

  1. Scan
    this starts the signal scan mode - AmiBroker will search through defined range of symbols and quotations for buy/sell signals defined by your trading rules.If one of the buy/sell conditions is fulfilled, AmiBroker will display a line describing when and on which symbol the signal has occurred. Next AmiBroker proceeds to the end of the range so multiple signals on single symbol may be generated.
  2. Explore
    this starts an exploration mode when AmiBroker scans through database to find symbols that match user-defined filter. The user can define output columns that show any kind of information required. For more information please check out "Tutorial: How to create your own exploration"
  3. Back Test
    this starts the back-testing mode - AmiBroker will search through defined range of symbols and quotation for BUY signal defined by your buy rule. If the buy rule is fulfilled, AmiBroker will "buy" currently analyzed shares. Next it will search for SELL signal. Then, if sell rule is fulfilled, AmiBroker will "sell" previously bought symbols. At the same time it will display the information about this trading in the listview. After performing simulation the summary will be displayed. Read more in "Tutorial: How to backtest your trading system"...
    The back testing parameters could be changed using Settings window.
  4. Settings - allows you to change back tester settings
  5. Optimize - allows you to optimize your trading system. Read more in the "Tutorial: How to optimize your trading system"...
  6. Check - this option allows you to check if your formula references future quotes. AmiBroker analyses your formula and detects if it uses quotes past current bar. Please note that formulas referencing future can give unrealistic backtesting results that can not be reproduced in real trading, therefore you should avoid systems that reference future.
  7. Report
    this displays Report window that allows you to watch, print and save test results
  8. Equity
    - available only after backtesting - displays Equity curve for currently selected symbol in a new chart pane. Check out "AFL: Equity chart and function".
  9. Export - allows you to export the results to CSV (comma separated values) file
  10. Close
    this closes the analysis window

Moreover you two options "Load" and "Save" for loading and saving your trading rules from/to files.

Enlarging results view in Automatic analysis window

There is a small arrow button next to the "Result list" horizontal divider line. This button is provided to enlarge/shrink the result list. When you are editing your formula it is good to have edit view larger, but to see the backtesting results it is convenient to enlarge the result list. In that case just click on that button and the result list will be enlarged (and the edit field will get shrinked). To do the reverse just click the button again.