Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Amibroker Unleashed: A comprehensive step by step guide to mastering Amibroker

Tags: amibroker

You are reading Amibroker Unleashed: A comprehensive step by step guide to mastering Amibroker by Enlightened Stock Trading originally posted on the Enlightened Stock Trading blog.

What is Amibroker and How Does it Work?

Amibroker is a technical analysis and trading software platform that is designed to help traders analyze market trends, test trading strategies, and optimize their trading systems. It is popular among both professional traders and individual investors, and is known for its advanced charting capabilities, powerful and fast backtesting features, and user-friendly interface.

Amibroker is a Windows-based software program that runs on your computer. It is used to analyze and trade financial markets, including stocks, futures, options, and forex. It allows you to create custom charting and analysis tools using its proprietary programming language called Amibroker Formula Language (AFL). You can use these tools to identify trading opportunities, backtest your trading strategies, and optimize your trades for maximum profitability.

In addition to its powerful analysis tools, Amibroker also offers a range of features that help traders manage their portfolio and execute trades. It has a built-in portfolio manager that allows you to track your positions and manage your risk. It also has real-time data feed integrations with various exchanges, allowing you to get real-time quotes and place trades directly from the software. It is also possible to draw data from multiple other sources including Norgate Data (which I use for US, Australian and Canadian stocks) and Metastock Data (which I use for all other stock markets).

Overall, Amibroker is a powerful and versatile trading platform that is suitable for both experienced traders and those just starting out. It offers a wide range of features and capabilities that can help traders analyze markets, test and optimize trading strategies, and execute trades with confidence.

Primary functions and capabilities of Amibroker

Amibroker is a comprehensive trading software platform that offers a range of functions and capabilities to help traders analyze markets, test and optimize trading strategies, and execute trades. Some of the primary functions and capabilities of Amibroker include:

Charting in Amibroker

One of the key features of Amibroker is its advanced charting capabilities. It offers a range of customizable charting tools, including line charts, bar charts, candlestick charts, and point and figure charts. You can use these charts to visualize market data and identify trends, patterns, and trading opportunities. It is also simple to overlay technical analysis indicators on price charts or plot indicators above / below the price chart through Amibroker’s ‘drag and drop’ interface.

In addition to its standard charting tools, Amibroker also offers a range of advanced charting features, such as:

  • Overlays: You can overlay multiple chart studies or indicators on a single chart to get a more detailed view of market trends and patterns.
  • Custom indicators: You can create custom indicators using Amibroker Formula Language (AFL) or import pre-built indicators from the Amibroker community.
  • Drawing tools: You can use a range of drawing tools, such as trend lines, fibonacci retracements, and Gann lines, to analyze market trends and patterns.

Overall, the charting capabilities of Amibroker are comprehensive and flexible, allowing you to create custom charts and analysis tools that suit your specific trading needs.

Finding Patterns And Signals With The Amibroker Scan Function

In addition to its charting capabilities, Amibroker Scan also offers powerful tools that allow you to quickly and easily identify trading opportunities. You can use these tools to scan for specific patterns and signals in the market, such as breakouts, reversals, and trend changes.

Amibroker scan functionality allows you to create custom scans using its proprietary Amibroker Formula Language (AFL). You can use these scans to search for specific patterns and signals in real-time, or you can save them and run them at a later time.

Using Amibroker Backtesting To Validate Trading System Ideas

One of the most important capabilities is Amibroker backtesting. This gives you the ability to backtest trading system, determine how profitable they are and optimize / improve trading system performance. Amibroker backtesting is a true portfolio backtest which is able to simulate the performance of a trading system that manages a portfolio of positions and calculate position size and allocate capital correctly between trades just as you would in real time trading.

Amibroker backtesting allows you to test a trading system against historical market data to see how it would have performed in the past. This can help you determine the viability and profitability of a particular trading system before risking real money on it. Of course past performance is not a guarantee of future profitability, however when done correctly (as taught in The Trader Success System), backtesting gives a high degree of confidence in your trading strategy’s performance.

You can use this backtesting engine to test your trading strategies on different markets, timeframes, and historical data sets. You can also customize all of the backtesting settings, such as trade sizes, position sizing, position score (trade ranking), entry / exit prices, stop loss levels and many more, to see how they affect the performance of your system.

In addition to its backtesting capabilities, Amibroker also offers a range of performance statistics and graphical outputs that allow you to evaluate the results of your backtests. These tools include equity curves, trade statistics, and risk analysis reports, which can help you understand the performance of your system and identify areas for improvement. The video below demonstrates how to use the Amibroker backtest report to evaluate trading system profitability:

The performance metrics from an Amibroker backtest are very thorough as you can see from the image below, and if you would like additional performance metrics these can be added by coding them in Amibroker AFL.

In addition to the Amibroker backtest performance statistics you also get graphical illustrations of the performance which include:

  • Portfolio equity curve
  • Underwater equity profile (Drawdown)
  • Monthly profit table
  • Profit distribution
  • Max adverse excursion
  • Max favourable excursion

The images below are an example of each from a trading system for the Canadian market called the High Roller that is included in The Trader Success System…

Portfolio Equity Curve:

Underwater Equity Profile (Drawdown):

Monthly Profit Table:

Profit Distribution:

Max Adverse Excursion / Max Favourable Excursion:

Optimizing trading systems in Amibroker

Once you have backtested a trading system idea and identified areas for improvement, Amibroker’s optimization tools can help you fine-tune your system to achieve better results. Optimization involves adjusting various parameters of your trading system to find the optimal combination that results in the best performance.

Amibroker has a built-in optimization engine that allows you to optimize your trading systems based on various performance metrics, such as net profit, compound annual return, drawdown, CAR/MDD, risk-adjusted return or any other performance metrics from the backtest report. You can use this engine to explore different parameter combinations and see how they affect the performance of your system.

The video below (and this blog post on Amibroker Optimization) demonstrate how to optimize a trading system in Amibroker:

One of the best things about Amibroker is the power and speed of the backtesting engine. Optimization is extremely fast and you can quickly evaluate the performance of your trading strategy over a wide range of parameter values.

In addition to its optimization capabilities, Amibroker also offers a range of analysis tools that can help you understand the results of your optimization runs. These tools include trade statistics, risk analysis reports, and 3D optimization charts, which can help you visualize the performance of different parameter combinations and identify the optimal settings for your system.

For example, the image below shows a 3D Optimization chart from an Amibroker optimization which allows you to see the interaction between two parameters when you optimize them simultaneously:

Signal generation in Amibroker

Amibroker also offers a range of signal generation tools that can help you identify trading opportunities and execute trades with confidence. These tools include alerts, which can notify you when a particular market condition or signal is triggered, scans to find your desired conditions, explorations to find more complex setups, and the trading system backtest, which can be used to generate the next day’s trades.

My preference for signal generation for EOD trading systems is to use the backtest because this insures we adhere to the timeless system trader wisdom:

Test What You Trade

AND

Trade What You Test

In order to generate trading signals using the backtest in Amibroker you need to “Enable Artificial Future Bar” in the analysis settings as illustrated below:

Once you have ticked the add artificial future bar to see tomorrow’s trade picks, run the backtest with a future date and you will see the new trades at the bottom of the trade log that you need to take as signals (both entries and exits).

You can use Amibroker’s alert system to create custom alerts based on various market conditions, such as price movements, indicator crossings, and chart patterns. These alerts can be triggered in real-time or on a scheduled basis, and can be configured to send notifications via email, SMS, or pop-up window.

Overall, Amibroker’s signal generation tools are powerful and flexible, allowing you to create custom alerts and trading systems that suit your specific trading needs.

Advantages and disadvantages of using Amibroker for technical analysis and backtesting

Amibroker is a powerful and versatile trading platform that offers a range of advantages for traders who use it for technical analysis and backtesting. Some of the key advantages of using Amibroker include:

  • Advanced charting capabilities: Amibroker offers a range of advanced charting tools that allow you to visualize market trends and patterns in great detail. You can create custom charts and indicators using its proprietary Amibroker Formula Language (AFL), or import pre-built indicators from the Amibroker community.
  • Powerful scanning tools: Amibroker’s scanning tools allow you to quickly and easily identify trading opportunities in the market. You can create custom scans using AFL or use its built-in scanner to search for specific patterns and signals in real-time.
  • Comprehensive backtesting engine: Amibroker has a built-in portfolio level backtesting engine that allows you to test your trading system ideas against historical market data. You can customize various backtesting settings and use its analysis tools to evaluate the results of your backtests.
  • Optimization capabilities: Amibroker’s optimization tools allow you to fine-tune your trading systems to achieve better results. You can explore different parameter combinations and use its analysis tools to understand the results of your optimization runs. Optimization within Amibroker is extremely fast
  • Signal generation tools: Amibroker offers a range of signal generation tools, including alerts, scans, explorations and backtesting your trading systems, that can help you identify trading opportunities and execute trades with confidence.
  • Free trial available: users can download a free trial from the Amibroker website to try it out and get a feel for the software before purchasing
  • Multiple EOD data sources: Many end of day data sources can be used with Amibroker including Norgate and Metastock formats which are the two providers I use for stock trading

However, there are also some disadvantages to using Amibroker for technical analysis and backtesting. Some of the key drawbacks of Amibroker include:

  • Complexity: Amibroker is a powerful and feature-rich platform, which means it can be complex and overwhelming for beginners. It takes time and effort to learn how to use its various features and capabilities effectively. Amibroker formula language is a bespoke language and while not complex (as far as coding languages goes), there is a learning curve.
  • Cost: Amibroker is a paid software platform, which means you will have to purchase a license in order to use it. While it is outstanding value considering the features it offers, but a paid version is required.
  • Limited real-time data: While Amibroker has real-time data feed integrations with various exchanges, the quality and availability of this data can vary. Some traders have reported issues with data lags or gaps, which can impact the accuracy of their analysis and trades.

Overall, the advantages and disadvantages of using Amibroker for technical analysis and backtesting will depend on your specific trading needs and goals. It is a powerful and feature-rich platform that offers a range of capabilities to help traders analyze markets, test and optimize trading strategies, and execute trades with confidence. However, it can be complex and costly, and may not be suitable for all traders.

How to Get Started with Amibroker: A Quick-Start Guide

The quickest way to get up and running with systematic trading using Amibroker is to join The Trader Success System as the program contains complete step by step video tutorials on how to do everything in Amibroker in addition to many pre-coded trading systems that work, a code library, trading system templates and The Rapid System Builder.

If you want to take the slow route 😉 and try to learn yourself, here are a few steps to get you started:

  1. Purchase a license: First, you will need to purchase a license for Amibroker in order to use the software. You can purchase a license online from the Amibroker website. I use the Professional version.
  2. Install the software: Once you have purchased a license, you can download the software and install it on your computer. Make sure to follow the installation instructions carefully and ensure that you have the necessary system requirements. It is a native windows application so just follow the prompts. I recommend you install it in the default location.
  3. Familiarize yourself with the interface: Amibroker has a user-friendly interface that is organized into various windows and tabs. Take some time to familiarize yourself with the layout and functionality of the different windows and tools.
  4. Import data: In order to use Amibroker for technical analysis and backtesting, you will need to import market data into the software. You can import data from a variety of sources, including CSV files, text files, and real-time data feeds. My preferred data source for Australian, US and Canadian stocks is Norgate data, for other markets I use Metastock data (these are affiliate links so I will get a small commission if you purchase through them). Amibroker also has a built-in data import wizard that can help you set up and configure other data sources. For instructions on setting up Norgate data in Amibroker click here.
  5. Create charts: Once you have imported your data, you can use Amibroker’s charting tools to visualize market trends and patterns. You can create custom charts using its various charting options, such as line charts, bar charts, and candlestick charts. You can also add indicators and overlays to your charts to get a more detailed view of market trends and patterns.
  6. Complete the tutorial in the Amibroker users guide which can be found here. Especially focus on learning basic Amibroker AFL (Amibroker Formula Language) as this is required for backtesting your trading system ideas.
  7. Backtest trading system ideas: Purchase or find a trading system that you want to test, convert the code to Amibroker AFL and perform your first backtest. This can be tricky to get all of the coding right and is something I cover extensively in The Trader Success System
  8. Optimize your trading systems: If you want to improve the performance of your trading systems, you can use Amibroker’s optimization tools to fine-tune your systems. You can explore different parameter combinations and use its analysis tools to understand the results of your optimization runs.
  9. Generate signals and alerts: I suggest you use the backtest to generate your trading signals as mentioned above (providing your system is a ‘next bar on open’ system). If you are entering using limit orders then you will need to code an exploration to find your signals, which can be easily added to the end of your trading system code.
  10. Continue learning: As you become more familiar with Amibroker, you can continue to explore its various features and capabilities to discover new ways to analyze markets, test and optimize trading strategies, and execute trades with confidence. There are many resources available to help you learn Amibroker, including the tutorials and blog posts on the Enlightened Stock Trading website I have listed below.

Backtesting with Amibroker

Backtesting is the process of testing a trading system against historical market data to see how it would have performed in the past. It is a valuable tool for traders because it allows them to evaluate the viability and profitability of a particular trading system before risking real money on it.

Amibroker has a built-in backtesting engine that allows you to backtest your trading system ideas with ease. Here is a guide to backtesting with Amibroker:

To backtest a trading system in Amibroker, you will first need to create a trading system using its proprietary Amibroker Formula Language (AFL). This involves writing a set of rules and conditions that define how your system should buy and sell assets based on market conditions.

Here are some steps to follow when coding a trading system in AFL:

  1. Define your entry and exit rules: First, you will need to define your entry and exit rules, which determine when your system should buy or sell assets. These rules can be based on a variety of factors, such as price movements, indicator values, and chart patterns.
  2. Set your position sizing and risk management rules: Next, you will need to define your position sizing and risk management rules, which determine how much of your capital to allocate to each trade and how to manage risk. These rules can help you manage your risk and optimize your trades for maximum profitability.
  3. Set up your backtest parameters: First, you will need to configure your backtest parameters, such as the market data to use, the time frame to test, and the initial capital for your backtest. You can also customize various backtesting settings, such as trade sizes, position sizing, and stop loss levels.
  4. Configure the analysis settings: Once you have coded your trading system, you can use the analysis window to select the markets and timeframe you wish to test it to see how it performs.
  5. Run your backtest: Once you have set up your backtest parameters, you can run your backtest by clicking the “Backtest” button in Amibroker. The software will then simulate your trades based on your system rules and the historical market data, and generate a report with the results.
  6. Evaluate the results: After your backtest is complete, you can use Amibroker’s analysis tools to evaluate the results. These tools include equity curves, trade statistics, and risk analysis reports, which can help you understand the performance of your system and identify areas for improvement. There are detailed instructions on evaluating the performance of your trading system in Amibroker here.
  7. Optimize your system: If you want to improve the performance of your trading system, you can use Amibroker’s optimization tools to fine-tune your system’s parameters. This involves adjusting various settings, such as trade sizes and stop loss levels, to find the optimal combination that results in the best performance. You can use Amibroker’s analysis tools to understand the results of your optimization runs and identify the optimal settings for your system. Read my blog post explaining the right way to optimize a trading system in Amibroker.

Advanced Amibroker Features and Techniques

Amibroker is a feature-rich trading platform that offers a range of advanced features and techniques to help traders analyze markets, test and optimize trading strategies, and execute trades with confidence. Some of the key advanced features and techniques in Amibroker include Monte Carlo Analysis and Walkforward optimization.

Monte Carlo analysis in Amibroker

Monte Carlo analysis is a statistical method that involves simulating market conditions and evaluating the performance of a trading system under different scenarios. Amibroker’s Monte Carlo analysis tools allow you to perform Monte Carlo simulations on your trading systems and evaluate the robustness of your system under different market conditions.

For example, the image below is the Monte Carlo compound annual return from my TSX High Roller Trading system that is included in The Trader Success System. This curve is generated by simulating 1000 equity curves by reshuffling (random selection with replacement) the daily percentage change in the backtested equity curve. This output shows that 50% of the runs had an annual return of 32% pa or better!

The Amibroker Backtest gives you Monte Carlo outputs like this for final equity, annual return, drawdown and lowest equity.

Walkforward optimization in Amibroker

Walkforward optimization is an advanced optimization technique (invented by Robert Pardo and explained in detail in his fantastic book Evaluation and Optimization of Trading Strategies). Walkforward optimization involves optimizing a trading system on a rolling basis, rather than on a fixed time period. This allows you to take into account changing market conditions and optimize your system for the current market environment. Amibroker’s walkforward optimization tools allow you to perform walkforward optimization on your trading systems and evaluate their performance over time.

Walkforward optimization is beyond the scope of this blog post, however members of The Trader Success System receive comprehensive training on how to employ this powerful backtesting technique to design their trading systems.

Overall, these advanced features and techniques can help you get a deeper understanding of your trading systems and improve their performance.

Amibroker vs. Other Technical Analysis Tools

Amibroker is a popular technical analysis platform that offers a wide range of features and capabilities to help traders analyze markets, test and optimize trading strategies, and execute trades with confidence. However, it is not the only technical analysis tool available, and traders may want to consider other options as well.

Here is a brief comparison of Amibroker with some other popular technical analysis tools:

Amibroker vs Tradestation:

Tradestation is another popular technical analysis platform that offers a range of charting, analysis, and trading tools. It is known for its powerful charting capabilities, automation and simple coding language called EasyLanguage. Tradestation has substantially better automation capabilities built in compared to Amibroker, but that is where the advantages end.

Tradestation limits users to the markets they support as you must use their own data, and the Tradestation is a 32 bit platform which is dramatically slower than Amibroker for backtesting and optimization. The Tradestation backtester is also a single instrument backtester compared to Amibroker’s portfolio backtester. This gives Amibroker a distinct advantage as you can develop and backtest a much wider range of trading systems using Amibroker compared to tradestation.

Amibroker vs Metastock:

Metastock is a technical analysis platform that offers a range of charting, analysis, and trading tools. It is known for its extensive market data coverage and powerful charting, screening, and filtering tools. Metastock is more powerful for charting and discretionary technical analysis compared to Amibroker, however, Metastock’s backtester is a single instrument backtester and so is limited in capabilities compared to Amibroker. Metastock is also more expensive than Amibroker.

If you want real time charting capabilities then Metastock is more feature rich than Amibroker. So if you are after charting and discretionary technical analysis then Metastock is a better pick, but if you want to eliminate the discretion, reduce the time your trading takes by trading systematically then Amibroker is the superior choice.

Amibroker vs TradingView:

TradingView  is a web-based technical analysis platform that offers a range of charting, analysis, and trading tools. It is very well known amongst technical traders and has a excellent charting interface. TradingView users also get access to a huge range of markets for a very small investment.

This is all great for charting and discretionary technical analysis, however for systematic trading TradingView is vastly inferior to Amibroker.

Amibroker vs Realtest:

Realtest is a relatively new backtesting platform developed by Market Wizard Marsten Parker. Compared to Amibroker, Realtest is much easier to program, backtests faster and is able to perform multi-system backtests and generate orders across multiple systems in a single step. This is a significant advancement compared to Amibroker. Unfortunately Realtest has more rudimentary charting and technical analysis capabilities as it is designed primarily for systematic trading.

Overall Realtest is worth a look and is competitive with Amibroker, though ultimately many traders may use multiple platforms depending on the need (I use Amibroker and Realtest).

How to learn Amibroker: Tips and Strategies to shorten your learning curve

If you are new to Amibroker and want to learn how to use it effectively, here are some tips and strategies to help shorten your learning curve:

Start with the basics: If you are new to Amibroker, it is important to start with the basics and learn how to navigate the software, import and organize your data, and create charts.

Practice and experiment: The best way to learn Amibroker is to practice using it and experiment with its various features and tools. You can use sample data to try out different charting, analysis, and trading techniques and see how they work in different market conditions. This will help you get a feel for the software and understand how it can be used to analyze markets and trade with confidence. Download the free Amibroker resources from Enlightened Stock Trading here to get access to a code library and trading system template to save you some time developing your first system.

Take advantage of online resources: There are many tutorials and articles available online, but if you start with the articles listed below from Enlightened Stock Trading you will find they are much better quality than most online video tutorials about Amibroker.

Purchasing a training course to shorten your learning curve: If you want more structured learning, you may want to consider purchasing a training course and community of Amibroker users. The Trader Success System gives you everything you need to master Amibroker, Systematic Trading and Trading Psychology. You even get a diversified portfolio of trading systems for a variety of markets, strategies and timeframes all precoded in Amibroker AFL!

Overall, learning Amibroker can be a challenging process, but with the right approach and resources, you can shorten your learning curve and become proficient with the software more quickly.

Links to Amibroker Tutorials and articles on Enlightened Stock Trading

·        The Ultimate Free Amibroker Tutorial Guide

·        How to Set Up Norgate Data with Amibroker

·        How To Set Up Your Amibroker Trading Software & EOD Data (Metastock Data)

·        Why You Have to Set the Add Artificial Future Bar in Amibroker to Generate Your Signals from The Backtest

·        Position Sizing In Amibroker With SetPositionSize Function

·        Backtest Stop Loss Orders with Amibroker

·        How to use the Amibroker backtest report for your trading system

·        Using the Amibroker backtest and optimization Reports to improve your trading systems

·        Optimizing an Amibroker trading system the right way

·        Visualise Amibroker Optimization Results – 3D Optimization Chart

·        How to deal with outlier trades in Amibroker Backtesting

·        How does Amibroker measure the maximum historical drawdown of a trading system in the backtest?

·        How to export the portfolio equity curve from Amibroker to Excel

·        Amibroker Tips: Stop The Price Data Window Disappearing

·        Amibroker Tutorial – Using TimeframeSet & TimeframeRestore to apply Weekly Indicato



This post first appeared on Learn Stock Trading, please read the originial post: here

Share the post

Amibroker Unleashed: A comprehensive step by step guide to mastering Amibroker

×

Subscribe to Learn Stock Trading

Get updates delivered right to your inbox!

Thank you for your subscription

×