Task: Configure AmiBroker and AFL

The following steps show you how to configure AmiBroker, load sample AFL files as Indicator, run Exploration and generate signal file that will be used by ATSXL.

Configure AmiBroker for FOREX

There are quite a few links from AmiBroker's website or other sources on the Internet that show you how to configure AmiBroker for FOREX trading. For example, you can use the following link as a good start point, which provides detailed instructions on using eSignal, IQFeed, DDE (Metatrader 4, FXCM) as FOREX data source.


Load the Indicator AFL files

Two AFL files are used by this QuickStart guide:

  1. ATSXL_GMMA_v2.afl
  2. ATSXL_MMAExpand_v5.1.afl

Here are a few notes that may help you better understand the use of these indicators as part of our trading strategy:

  • Many parameters used by GMMA and Bollinger Band here can be tweaked (as you will see them as parameters)
  • GMMA's Investor lines are not shown (as you will see parameter "Show Investors" is set to No)
  • GMMA Trader lines are used to detect if expansion or compression pattern is formed, which creates entry and exit signals (hollow arrows in red or yellow) for ATSXL.

    ATSXL will read these signals, match them against your trading strategy (or trading plan), then manage the order and positions accordingly.
  • Bollinger Band here are simply used to create trailing stop signals (small hollow triangles in red or yellow) for ATSXL.

    ATSXL processes these signals similarly as it does with entry and exit signals.
  • You can later use any other indicators or algorithms to create entry, exit and trailing stop signals, i.e. the slowest Trader line could be a good candidate for trailing stop.
  • You can create any other signals, i.e. take profit, re-entry, and so on, and configure ATSXL to use these signals and manage your orders and positions by your design.

Please copy these files into AmiBroker's default directory for AFL files. If you install AmiBroker on D:\Program Files\AmiBroker, then the directory should be D:\Program Files\AmiBroker\Formulas\Custom.

Load these two AFL files onto one of EURUSD 1HR charts.

The screen shot shows how these indicators look like.


The screen shot shows parameters used by the above indicators:


Modify the Exploration AFL file

AmiBroker Exploration will use ATSXL_MMAExpand_Explore_v5.1.afl to generate signals for ATSXL. You should modify this file to use the correct path and file name.

The following mentioned sub-directory msgout will be automatically created when you unzip the ATSXL package, and you can modify the configurations below to use any other directory.

You can find the following lines in the source, modify the path and name accordingly. Don't forget to use "\\" instead of "\".

// define the full path and file name for message out
// NOTE: double back slash "\\" is used here
strFilePath01 = "D:\\DEV\\ATSXL\\bin\\Pack\\msgout\\atsxl_msgout_tws.txt";

Suppose you have ATSXL installed on D:\myATSXL, you should use the following code:

// define the full path and file name for message out
// NOTE: double back slash "\\" is used here
strFilePath01 = "D:\\myATSXL\\msgout\\atsxl_msgout_tws.txt";

You also need to check setting of MSG_Outbound_File on CFG worksheet to make sure ATSXL can read the above file. For example:

MSG_Outbound_File = msgout\atsxl_msgout_tws.txt

Setup the Exploration

Now you can copy the modified ATSXL_MMAExpand_Explore_v5.1.afl file into AmiBroker's default directory for AFL files. If you install AmiBroker on D:\Program Files\AmiBroker, then the directory should be D:\Program Files\AmiBroker\Formulas\Custom. Load the AFL file from AmiBroker's Automatic Analysis window.

The screen shot shows the AFL files loaded from Automatic Analysis window with highlighted fields (and buttons) you may pay more attention:


The screen shot shows the parameters used by the AFL file. Note that you want to make the parameter's value the same as you use in ATSXL_MMAExpand_v5.1.afl so the the signals generated by Exploration will match what you see from the above GMMA and MMAExpand indicators.


Run the Exploration

Now you can press Explore button to run the Exploration, which generates a list of signals shown in the above screen shot.

In addition, you should check the path that is used in ATSXL_MMAExpand_Explore_v5.1.afl, i.e. "D:\myATSXL\msgout\", which should have a file, named "atsxl_msgout_tws.txt", created there.

Every time you run the Exploration, the above "atsxl_msgout_tws.txt" will be appended with signals. This file will be renamed automatically by ATSXL later on.

Check the signal file after the Exploration

You can open the signal file (i.e. "atsxl_msgout_tws.txt") with any text editor to see how those signals look like. Here are a few sample lines:

Label=SCAN_START | Time=10/22/2013 9:37:35 PM
Label=MA_Signal | Ticker=EURUSD | Time=6/1/2010 6:25:00 PM | Signal=Dn | Rate=1.2231 | FLD_H=1.2310 | FLD_I=1.2310 | FLD_J=1.2197
Label=MA_Signal | Ticker=EURUSD | Time=6/2/2010 4:25:00 AM | Signal=Up | Rate=1.2225 | FLD_H=1.2199 | FLD_I=1.2255 | FLD_J=1.2199
Label=MA_Signal | Ticker=EURUSD | Time=6/2/2010 5:25:00 AM | Signal=Up | Rate=1.2198 | FLD_H=1.2198 | FLD_I=1.2252 | FLD_J=1.2198
Label=MA_Signal | Ticker=EURUSD | Time=6/2/2010 9:25:00 AM | Signal=Dn | Rate=1.2232 | FLD_H=1.2240 | FLD_I=1.2240 | FLD_J=1.2191
Label=MA_Signal | Ticker=EURUSD | Time=6/2/2010 1:40:00 PM | Signal=Up | Rate=1.2251 | FLD_H=1.2200 | FLD_I=1.2247 | FLD_J=1.2200
Label=MA_Signal | Ticker=EURUSD | Time=6/2/2010 5:29:00 PM | Signal=Up | Rate=1.2246 | FLD_H=1.2200 | FLD_I=1.2249 | FLD_J=1.2200
Label=MA_Signal | Ticker=EURUSD | Time=6/2/2010 6:29:00 PM | Signal=Up | Rate=1.2238 | FLD_H=1.2199 | FLD_I=1.2251 | FLD_J=1.2199
Label=MA_Signal | Ticker=EURUSD | Time=6/2/2010 7:29:00 PM | Signal=Up | Rate=1.2235 | FLD_H=1.2200 | FLD_I=1.2253 | FLD_J=1.2200
Label=MA_Signal | Ticker=EURUSD | Time=6/2/2010 11:39:00 PM | Signal=Up | Rate=1.2296 | FLD_H=1.2216 | FLD_I=1.2289 | FLD_J=1.2216

Upon here, you have configured AmiBroker successfully.

You can return to any of the following link: