Creating your own indicators

There are two ways to create your own indicators:

1) using drag-and-drop interface

2) by writing your own formula

First method, using drag-and-drop interface is very simple and does not require writing single line of code. To learn more about drag-and-drop indicator creation please check Tutorial: How to use drag-and-drop charting interface

Second method involves writing an indicator formula in flexible AFL (AmiBroker Formula Language). You can find the description of this language in AFL Reference Guide section of user's guide. Here we will present basic steps needed to define and display your own custom indicator. In this example we will define an "indicator" that will show line volume graph (opposite to built-in bar volume graph).

Just follow these steps

  1. Select Analysis->Formula Editor option from the menu as shown below:

  2. You will see the following dialog displayed on the screen:

    It presents an empty Formula Editor window.

  3. Now single-click in the edit field located in the editor toolbar to change the name of the indicator:

    Now you can edit the name of the custom indicator. Give it the name "My own indicator". After you press ENTER key the caption will be updated with the new file name as shown below:

  4. Now type the formula:

    Plot( Volume, "My volume chart", colorGreen );

    This formula instructs AmiBroker to plot built-in Volume array. Second parameter specifies the title of the plot and third parameter defines the color. The picture below shows formula editor after entering the code:

  5. Now click Apply indicator toolbar button (or choose Tools->Apply indicator menu) as shown in the picture and close editor by pressing X button in the upper right corner of the editor window.

Now the indicator you have just written is displayed as a chart. You can also find it stored as a formula in Chart tree:


Now you can improve your indicator by adding Param functions so both color and style of the plot can be modified using Parameters dialog. To do so, click with RIGHT mouse button over chart pane and select Edit Formula (or press Ctrl+E)

And modify the formula to:

Plot( Volume, "My volume chart", ParamColor("Color", colorGreen ), ParamStyle("Style", 0, maskAll ) );

Then press Apply indicator to apply the changes. Now click with RIGHT mouse button over chart pane again and select Parameters (or press Ctrl+R) and you will see parameters dialog allowing to modify colors and styles used to plot a chart:

Also in the "Axes & Grid" tab you will be able to change settings for axes, grids and other charting options referring to this particular chart:

For further information on creating your indicators please check Using graph styles and colors tutorial section

For further reference on using Formula Editor please consult Environment - Formula Editor and AmiBroker Formula Language - AFL Tools sections of AmiBroker User's guide and using AFL editor.