Amibroker Backtest Tutorial in 5-Minute - AlgoJi

This Amibroker Backtest Tutorial has been written for new Amibroker users, who quickly want to backtest an AFL. Beginners who face the question “How to backtest in Amibroker” have just come to the right place. For detailed Amibroker backtest tutorial, please refer:

Step 0: From the top Amibroker menu, click Analysis, then click Old Automatic Analysis. Amibroker may give a notification to use New Analaysis, but we continue with the Old Automatic Analysis because it is easier to use for first timers.

Refer the image below for Amibroker backtest settings from Step 1-6.

Amibroker Backtest Tutorial

Step 1: Pick the AFL file for backtesting. By default, AFL files are saved in the Custom folder under Amibroker installation directory, just as the path shown in above image.

Step 2: Select the stock in which you want to backtest as shown in image. First timers are advised to backtest on “current symbol” which is same stock chart in your Amibroker.

Step 3: Select date range for backtest. Recommended to run on “all quotations” as shown above.

Step 4: Click the parameters button to set/change AFL parameters.

Step 5: Click the “Settings” button. This opens the AA Settings window which is very important for backtesting.

Amibroker Backtest settings


Step 5-1: Set the initial equity 10000 or higher. This is the actual turnover value required to backtest a trade. For example to backtest on Nifty Future 1 lot, you will need to set initial equity = 75 (lot size) *9000 (max price) = 675000.

Step 5-2: Set the “Positions” button as Long and Short by default. If it gives error later in backtest, you need to set it as Long Only or Short Only

Step 5-3: Set the periodicity (time frame) on which you want to backtest

Step 5-4: Set the Round Lot size as 1. This allows realistic backtest  without fractional shares

Step 5-5: If you want to set comissions, click “Define” button. It is recommended to set commissions minimum 0.01% of trade value.

Step 5-6: Click the “Trades” tab.  It is recommended to set all prices as “close” with a delay of 0.

Step 5-7: Click the “Stops” tab. Usually exit conditions are defined in AFL itself so it is recommended to disable all stops.

Step 5-8: Click the “Report” tab. Ensure that “Trade List” option is selected.

Click OK and you are ready to backtest! Hit the Backtest button which will display all trades as well as summary below.

Step 6: Click Reports button for detailed reports on backtest.

Register Immediately for Course Access

Mumbai Conference: Lightning Talks, Breakout Sessions, Algos for Non Programmers & Algos Using Data Science, and lot more…