The core of Amibroker's operations are AFL files. They enable you to test concepts, create unique indicators, and customize the charts. Long before they truly comprehend what AFL accomplishes, many traders learn about it. From the time you get AFL data until they appear on your chart, this article removes the noise and demonstrates how to use them.
What Amibroker's AFL Files Actually Do
Amibroker calculates signals, indicators, and strategies using a programming language called AFL (Amibroker Formula Language). AFL is typically used to write any custom logic you come across online. The platform understands the code and implements the specified rules to your chart or backtest when you load these scripts into Amibroker.
Where to Find AFL Files
You may use the Formula Editor to create your own AFL or download pre-made files from reputable websites, blogs, and forums. The majority of AFLs are text files with the extension.afl. The primary working file is usually the.afl file, while some are supplied with files that include templates or accompanying graphics.
Step 1: Save the AFL File in the Correct Folder
Formulas are kept in Amibroker's "Formulas" directory. The platform searches for scripts here.
C:\Program Files\AmiBroker\Formulas is the typical path.
This contains folders like:
● Custom
● Indicators
● Exploration
● System
To keep everything organized, you may make new folders.
To include an AFL:
1. On your PC, save the.afl file.
2. It can be copied or moved to the desired folder under the "Formulas" directory.
Only AFLs kept in this area will be shown by Amibroker.
Step 2: Load the AFL Through the Formula Editor
The Formula Editor is where you'll work if you wish to review the code or make any changes.
Procedure:
1. Launch Amibroker.
2. From the top menu, select Analysis.
3. Select Formula Editor.
4. Choose the AFL you added by using File → Open.
Before using the script, you may now examine or modify it.
This step helps you understand what the strategy or indicator is doing, but it's unnecessary if you don't plan to change the file.
Step 3: Apply the AFL to a Chart
Attach it to a chart to view its output in real time.
Here's how:
1. In Amibroker, open any price chart.
2. Examine the Charts panel located on the left.
3. Open the folder that contains your AFL.
4. You may either drag the script onto the chart or double-click it.
The indication, signals, or overlays that the algorithm produces are displayed when the chart is refreshed. You will see arrows, markers, or other graphics defined in the code if the script has Buy/Sell rules.
Step 4: Use AFL in the Analysis Window
Backtests, scans, and explorations are also powered by AFL. Instead of the chart, these operate from the Analysis window.
To make advantage of the AFL there:
1. From the toolbar, choose Analysis.
2. From the list, choose the AFL.
3. Choose what you wish to run:
4. Look for conditions and data tables.
5. Look for matches in real time
6. Backtest for performance outcomes
While strategy-based AFL files frequently contain comprehensive trading rules for the backtesting engine, many AFL files are built just for charts.
Step 5: Edit or Customize the AFL
AFLs are always subject to modification. You can change parameters like periods, thresholds, or color settings if you know the syntax.
To change:
1. Launch Formula Editor and open the AFL.
2. Make changes to the text.
3. Use Ctrl+S to save the file.
4. Update the chart.
Amibroker immediately refreshes the output following the save.
Step 6: Troubleshoot Common AFL Issues
In the event that an AFL fails to load or displays an error:
1. Verify that the file is located in the right folder.
2. Check for any undefined variables or missing brackets in the code.
3. Verify that the data settings you are using are compatible. Certain AFLs rely on volume, certain bar intervals, or OHLCV data.
4. After adding a lot of new files, restart Amibroker to rebuild the index.
The majority of problems are caused by straightforward file location mistakes rather than the script itself.
Concluding Remarks
Amibroker goes well beyond simple charting with AFL files. You can create nearly anything, including signals, indicators, and whole trading systems, after you understand how to add, load, and apply them. The versatility offered by AFL is the primary reason traders like Amibroker for technical analysis and strategy work, and the procedure remains straightforward after a few attempts.