Backtesting in AmiBroker

TrueData Team · 02 September 2020 · 2 Comments


Backtesting in AmiBroker

Before getting into any technicalities or know-how, it is important for us to know what do we mean by backtesting in Amibroker. Backtesting is an easy process used by Traders to evaluate the Trading Ideas and provides information regarding how good is a trading system based on historical datasets. Precisely, it talks about the behavior of the trading system, risks involved in a particular trading system, and more regarding the performance of the trading system. There is one such program AmiBroker which performs all these functions and does much more for the traders.


To keep it simple, AmiBroker is a full-fledged professional Technical Analysis and charting tool which can be used by the traders to Analyse Market, prepare charts, and for backtesting trading strategies. It is quite important for you to know about AmiBroker is before using it to backtest. Better make an informed decision rather than just going with a feature that you might regret later (which you won’t!)

Features of AmiBroker

Features-of-AmiBroker Here is a list of features which are offered by the trading platform apart from backtesting-

Analysis Window -

analysis window On the analysis window, you will be able to see almost everything, i.e. portfolio, walk-forward tests, optimization, backtests, explorations, Monte Carlo Simulation, and so on.

Exploration/Market Screening -

exploration AmiBroker is a multi-purpose tool for data screening/mining which supplies programmable output with infinite rows and columns.

Charting -

This feature of Charting in AmiBroker comes with several built-in indicators, multiple time frames (which can be used as per your own convenience), drag and drop indicators, customizable parameters, object creating capabilities, etc. Sliders are the good options to modify parameters in real-time and can also customize it in various styles and gradients.

Walk-forward Testing -

It is ideal for confirming the robustness of the trading sample before and after optimization.

Multi-Threading -

AmiBroker assigns different threads for each graphics renderer and each formula chart.

Code Editor -

The code editor pairs up with parameter call-tips, auto indenting, code folding, etc. Whenever you encounter an error, a meaningful message alerts you promptly.

Ranking and Scoring -

ranking It is used to perform bar-by-bar ranking depending upon the user score to find a suitable trade.

Advantages of AmiBroker


  • It provides the user with top-notch technical support for trading accounts.
  • The main features of this tool are fast array and matrix processing.
  • AmiBroker ensures that the traders are provided with safe and full-proof trading support in order to have 100% security and that you don’t lose money.
  • The features of AmiBroker are customizable and flexible.
  • It is the fastest backtesting tool and provides the user with a custom backtesting facility, custom metrics, rotational trading, etc. Also, it provides the user with advanced ranking, scoring, and positioning.

The most productive thing that can be done in the analysis window is to backtest the trading strategy on historical data. It helps you to gain insight into the strengths and weaknesses of the system before you begin to invest real money. And thus, AmiBroker is a feature which can help you to save lots of money.

Writing Your Trading Rules

Writing-Your-Trading-Rules The first thing that needs to be done is that you must have objective or mechanical rules to enter and exit the market. This step is necessary in order to create a base of your strategy and whether or not the system matches with risk tolerance, portfolio size, money management techniques, and several other factors. Once you have established rules for trading, you must write to them as buy and sell rules in AmiBroker Formula Language.


Backtesting In order to Backtesting in AmiBroker, you need to click on the Backtest button in the Automatic analysis window. Ensure that you have typed the formulas which contain buy and sell trading rules. Once the correct formula is entered, AmiBroker starts to analyze symbols according to trading rules and generates a list of simulated trades. This process is rapid in terms that you can easily backtest thousands of symbols in a few minutes. There is a progress window that will show the estimated completion time. If you wish to stop the process at any given point of time, click on the Cancel option in the progress window.

Analyzing Results

Analyzing-Results When the process is completed, you will be presented with a list of simulated trades in the bottom part of the Automatic analysis window aka the Results pane. Here, you can examine when the buy and sell signals occur only by double-clicking on the trade in the Results pane. Post this, you are presented with raw or unfiltered signals for each bar where buy and sell conditions are met. If you wish to see only a single trade arrow (opening and closing currently selected trade) you are required to double click a line while holding the SHIFT key pressed down. The other option that you can choose is the kind of display by choosing the appropriate item from the context menu which appears once you click on the results pane with a right-click. In addition to the results, you will also be provided with detailed statistics on the performance of your system by choosing the Report option.

Changing Your Backtesting Settings

Changing-Your-Backtesting-Settings Backtesting in AmiBroker makes use of predefined values for performing its task including portfolio size, periodicity, i.e. daily/weekly/monthly, amount of commission, type of trades, price fields, interest rates, and so on. These settings can be altered by the user settings window. Post changing the settings, you must remember to run your backtesting if you wish the results to be in-sync with the settings.

Advanced Concepts

Until now, we have discussed fair simple use of the backtesting. However, AmiBroker comes with a lot more sophisticated concepts and methods. We will be listing the new introduced-features of the back tester. There you go -

  • AFL scripting host for Advanced Formula Writers
  • Enhanced Support for Short Trades
  • Way to Control Order Execution Price from the Script
  • Types of Stops in Back-tester
  • Position Sizing
  • Round Lot Size and Tick Size
  • Margin Account
  • Backtesting Futures

Frequently Asked Questions (FAQs)

Ques. 1. What skills do I require to build an effective Algo Trading Solution using AmiBroker?

Ans. 1. Here is the list of following skills you may require to build an effective Algo Trading Solution using AmiBroker  -

  • It is necessary for you to have knowledge in AmiBroker AFL Programming, Backtesting, Optimization, System Validation of Training
  • You must have an understanding of the Broker API’s/Bridge Function and knowledge in the know-how of integrating with AmiBroker.
  • It is essential to have knowledge about VPS (Virtual Private Servers) and how to remotely connect and deploy AmiBrokers, Trading Terminal, and Bridge Components in the servers.
  • You have knowledge about Setting Risk Control Parameters and Order Execution Logic.
  • You must take data backup and trade logic backup at regular intervals.
  • It is necessary to use a statistical test like Monte Carlo Analysis to determine if the trading system has broken.

Ques. 2. Are there any additional requirements to build an effective automated trading system infrastructure?

Ans. 2. Yes, you do need additional requirements to build an effective automated trading system infrastructure. Here are these additional requirements -

  • You must have a Good Historical Data for Backtesting.
  • It is necessary to have a Good Realtime for Live Trading.
  • You should have Trade Execution Capabilities, i.e. market order, limit order, bracket order, cover order, etc.
  • It is essential for you to have a good understanding of money management and types of systems, i.e. trend following, mean reversion, pattern recognition, seasonal, cynical, and so on.
  • It is important for you to have a sense of risk management in terms of what to trade, symbol level stop-loss, portfolio level stop-loss, fnoban check, panic button square-off, etc.
  • You require capabilities in position sizing, i.e. partial profit/loss booking, adding positions to the existing trade (scale).

Ques. 3. What availabilities does one need after taking your system live?

Ans. 3. You should have the following availabilities after taking your system live -

  • Ensure that the trading model that you use is free of glitches and that the system is tradeable.
  • You should have enough time to compute and place orders.
  • The assumptions that you make regarding trading costs, i.e. brokerage, commissions, slippage, taxes are realistic.

Ques. 4. Are there any disadvantages to use AmiBroker?

Ans. 4. Well, not technically disadvantages but yes, there are a few issues with AmiBroker which one must know -

  • This tool is not really suitable for those who aren’t tech-savvy and are unaware of the programming languages such as HTML, C/C++, etc.
  • This tool works best for those who are keen to write their own codes.
  • Since the tool is fully customizable, AmiBroker does not have a standard template, to begin with. It might not be an issue for an advanced coder, however, it can be quite cumbersome to come up with a new code or research about it.
  • The managing of quotes takes a lot of time.
  • It isn’t practically possible for you to run two or more databases per instance/session.
  • AmiBroker isn’t suitable for big traders who transact in lump-sum money and not for one-time traders or small traders.

AmiBroker is one of the best when it comes to coding, programming, developing, however, it does not satisfy those who are from a non-technical background. One requires extensive training before using the analysis and charting tool. Even though AmiBroker has quite a number of features and tools, that makes it the trading process safe and satisfying. We are hoping that in neat future AmiBroker will become popular among the non-technical users as well. Till then, keep trading!

TrueData Team

Welcome to our blog!

This blog is a collaborative effort and was compiled by multiple members of the TrueData Team

Comments (2)
Atul Tanna
January 23, 2021

Does Amibroker give the right signal at the right time on meeting the criteria as compared to Chartink

Does Backtesting a new strategy really get results for successful trades? - TrueData BlogTrueData Blog
June 10, 2021

Backtesting is one of the most key parts of trading. It helps you to be sure of your strategies that you are implying. Mainly, backtesting relies on the historical data of the trades in the past. It helps you to make sure that you are not blindly trading but using foolproof  strategies. The question which revolves in the mind of traders is – Does Backtesting a new strategy really get results for successful trades? Go through the complete article and find out yourself!

Leave a Comment