Formula Editor

A new AFL Formula Editor features:

These features greatly simplifies writing formula and provides instant help so time needed to write formula decreases significantly.


Formula Editor menu options are described in detail in Menus: Formula Editor chapter of the guide.


The Formula Editor toolbar provides the following buttons:


Typical use of Formula Editor is as follows:

Syntax highlighting

AmiBroker's AFL editor features user-definable syntax highlighting that automatically applies user-defined colors and styles to different language elements like functions and reserved variable names, strings, numbers, comments, etc. This feature greatly simplifies code writing. You can modify coloring scheme in Preferences window.

Enhanced error reporting

When you make an error in your formula, AmiBroker's enhanced error reporting will help you to locate and fix an error by highlighting the place where error occured and displaying extended error description with the examples of common mistakes and advice how to fix them. In version 5.80 description of errors are displayed in-line with the code.

A message bar displays total number of errors and/or warnings. If you press "Go to error" button the editor will move the caret to the relevant line with the error, if you press it again, it will move to the next error and so on. If you close the message bar with the "X" button all error messages will be cleared (hidden) from the view. You can use Edit->Clear Error Message menu (Ctrl+E) to clear individual error message (in the current line).

Context  help

You can quickly display relevant AFL function reference page if you press F1 key or choose "Function reference" from the context menu while the caret is inside or right after function name as shown in the picture below:

Automatic statement completion

The automatic completion feature (available when you press CTRL+SPACE key combination) finishes typing your functions and reserved variables for you, or displays a list of candidates if what you've typed has more than one possible match. You can select the item from the list using up/down arrow keys or your mouse. To accept selection press RETURN (ENTER). You can also type immediately space (for variables) or opening brace (for function) and AmiBroker will auto-complete currently selected word and close the list. To dismiss the list press ESC key.
Parameter Information
When you are typing a function, you can display a Tool Tip containing the complete function prototype, including parameters.  The Parameter Info Tool Tip is also displayed for nested functions.

With your insertion point next to a function, type an open parenthesis as you normally would to enclose the parameter list.

AmiBroker displays the complete declaration for the function in a pop-up window just under the insertion point.

Typing the closing parenthesis dismisses the parameter list.

You can also dismiss the list if you press arrow up/down key, click with the mouse or press RETURN.

Editor configuration

The settings of the AFL editor can be changed using Tools->Preferences, Editor page:

Window control

AFL Editor Window as a separate frame can be brought on top or to the back as any other application window using Windows Task Bar. In addition to that there is a Window->Toggle Frame menu (and Ctrl+` shortcut, ` is the tilde key just above TAB key on most keyboards) that allows to quickly toggle between AmiBroker main frame and AFL editor frame.

The user may also turn on Window->Keep On Top feature that keeps editor window on top of AmiBroker main frame.


Line numbers margin, Selection margin and Fold margin can be switched on/off using View menu. In this menu there are also options to fold/unfold all code.

Code snippets

Code snippet is a small piece of AFL code. It can be inserted by:

For more information about Code snippets see Tutorial: Using Code-snippets


A bookmark is a marker that allows to quickly jump to marked line within the formula.

To set/remove the bookmark use Edit->Bookmark->Insert /Remove menu or Ctrl+F2 key. When you set the bookmark a light blue marker will be shown in the left-hand margin. Now with a couple of bookmarks set you can quickly navigate (jump) betwen them using F2 key - goes to next bookmark, Shift+F2 key - goes to previous bookmark. You can clear all bookmarks using Edit->Bookmark->Clear All. Please note that bookmarks are saved along with debug information (breakpoints/watches) in the separate file with .dbg extension.

Find in Files

Find in Files functionality is available from Edit->Find in Files menu and allows you to search all files in selected folders for specified text. The search results are presented in the Output window (Window->Output menu) like this:

Filepath\ Line contents

Now if you double click on that output line AmiBroker would automatically open given file in the new editor tab.

Block comment/uncomment

The AFL editor now provides a tool to automatically comment out blocks of selected lines. The tool adds a // (double slash) comment to every line within selected area. To use this tool, select some lines using mouse or cursor + SHIFT key, then use Edit->Line Comment. All lines within selected range will be commented out with // (double slash). To uncommment, select the range again and choose Edit->Line Comment once again.

Clickable links in comments

The AFL Editor now supports clickable JavaDoc/Doxygen-style links in doc comments. To use links in comments you have to put @link command followed by path to file or URL inside JavaDoc/Doxygen style comment:

Now when you hover the mouse over @link command you will see the underline that indicates it is clickable. It reacts to double click (not single click). When you double click it linked document will be open.

@link command can open web pages, local files (both relative and absolute paths are supported) with Windows-registered program to open given file type. So if you use:

/// @link something.doc

then MS word would be used.

/// @link test.xls

would open test.xls in Excel.

Relative paths refer to AmiBroker working directory. Html files are open with default browser, txt files are usually open with Notepad (or whatever application you use). If file does not exist then you will get an error message.