Backtesting in AmiBroker

TrueData Team · 02 September 2020 · 1 Comments


Backtesting in AmiBroker

Before getting into any technicalities or know-how, we need to know what we mean by backtesting in Amibroker. Backtesting is an easy process used by Traders to evaluate 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 that can be used by traders to Analyse the Market, prepare charts, and backtest trading strategies. You need to know about AmiBroker 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 that 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 at your convenience), drag-and-drop indicators, customizable parameters, object-creating capabilities, etc. Sliders are good options for modifying parameters in real time and can also be customized 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 on 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 foolproof trading support 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. Thus, AmiBroker is a feature that 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 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 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 in 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.

Read More: No.1 Realtime (L1) Data Vendor of NSE (Stocks, Indices, F&O & Currency) & MCX 

Changing Your Backtesting Settings

Changing-Your-Backtesting-Settings Backtesting in AmiBroker makes use of predefined values for performing its task including portfolio size, and 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 backtesting. However, AmiBroker comes with a lot more sophisticated concepts and methods. We will be listing the newly 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 know about AmiBroker AFL Programming, Backtesting, Optimization, System Validation of Training
  • You must have an understanding of the Broker APIs/Bridge Functions and knowledge of 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 know 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 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, and taxes are realistic.

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

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

  • This tool is not suitable for those who aren’t tech-savvy and are unaware of programming languages such as HTML, C/C++, etc.
  • This tool works best for those who are keen to write their 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, and 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 several features and tools, that make the trading process safe and satisfying. We are hoping that shortly AmiBroker will become popular among 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 (1)
Atul Tanna
January 23, 2021

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

Leave a Comment

Related Articles

How to Display Range Bars in Amibroker ?

Introduction Lately, several traders have started using Range Bars for their tr...

Investing / Trading
Investing / Trading
Does Backtesting a new strategy really get results for successful trades?

Does Backtesting a new strategy really get results for successful trades? The n...

Is Amibroker Your Best Trading Decision Making Software?

Do you still get daunted by the feeling of facing losses while trading in stock...

Relevant Tags