Advanced AmiBroker Coding
Are You a Trader Who Is Looking to Learn Advanced AmiBroker Programming Skills to Improve Your Trading Results?
You already know that AmiBroker is an extremely powerful tool for performing technical analysis. At Connors Research, it’s the application that we use for everything from simple signal generation to simulating portfolio results for complex strategies involving limit orders, scaling, hedging and more. If you’re ready to tackle these advanced analysis tasks yourself, then this course is for you.
Sign-up for Our 2-Day Course
On June 9 & 10 Matt Radtke, Director Of Research for Connors Research taught the same AmiBroker programming techniques Connors Research uses in order to create and build high performing strategies. By the end of this course, you will have the ability to do your own high grade testing and analysis that so many professional traders rely upon to improve their trading and investing returns.
By harnessing the full power of AmiBroker, you can simulate historical results for a system that mirrors exactly the way you trade, and thereby gain insights into how it might perform in the future. In this course we will teach you exactly how to do this.
This course is designed for traders who want to use AmiBroker to create complex backtests and optimizations using the Custom Backtester (CBT) interface. At the completion of this course, you will be able to:
- Determine when to use each of the three levels of the Custom Backtester. Within minutes customize any system to fit your personal trading style, psychological profile and risk preference. Get into the nitty-gritty details of system development to build your private trading system. You will learn how to customize your own position sizing, your own hedging strategy, your own trade timing, and your own scale-in strategy.
- Add custom metrics via the Custom Backtester. Flesh out more robust trade results so you can compare different trading systems using customer metrics like Trade Quality. Integrate annual breakdowns of trades or annual breakdown of returns into your results. Verify that your system will perform consistently month after month and year after year, and remain robust through both good years and difficult years.
- Develop your own trading model from scratch so that you can evaluate how your ideas would do under historical trading conditions.
- Use some of AB’s more powerful functions. Now you can refine and improve your existing trading system, lower your risk, and improve performance.
- Perform correct optimizations. Avoiding the pitfalls for “over-optimization” develop historically validated enhancements to your trading system.
- Utilize multiple time frames, such as using weekly bars in a daily bar test. Further improve your system’s accuracy by trading along with short and long-term time frames.
- Scale into positions. Build into your trading system, the same proprietary scaling-in methods of Connors Research’s best strategies.
- Take portfolio considerations into account in your coding. Find ways to lift the performance of multiple positions in your portfolio, taking into consideration the overall performance of your portfolio.
- Over seven hours of online instruction with Matt Radtke.
- Several breakout sessions during which you will spend hands-on time with AmiBroker
- AFL and CBT code templates that you can easily modify for you own needs.
- AmiBroker version 5.5 or later installed.
- A data source configured to work with AmiBroker (we can help you with this before the class, if needed).
- Basic familiarity with AFL and the topics covered in the “Introduction to AmiBroker” course.
AmiBroker is an extremely powerful analysis tool, and like any powerful tool it requires training and practice to use it effectively. In today’s course we will do a deep dive into some of AmiBroker’s most powerful functionality, including portfolio backtests, optimizations, and the Custom Backtester Interface or CBT.
AmiBroker’s AFL scripting language provides a diverse set of variables, commands and functions that you can use to develop custom indicators, scans, explorations, backtests, and explorations. In fact, the AFL help file lists over 350 AFL functions. In this session we will discuss a few of the functions that you will find most useful as you begin to develop more advanced AFL scripts.
An optimization allows you to automatically execute a set of backtests in which each test has a unique set of input parameters. Each test (combination of parameters) typically corresponds to a specific strategy variation. For example, we might want to test a strategy in which the ConnorsRSI threshold for trade entry varies from 10 to 25 in increments of 5. In this session we will discuss how to convert the AFL for a back test into an optimization.
- How to set up
- The Optimize function
- Using the Switch function to handle odd increments
TimeFrame Compress/Expand and Set/Restore
When you run a backtest, AmiBroker allows you to select the base duration for each “bar” of the test. This is also known as the timeframe. You can test 1-minute bars, daily bars, weekly bars, etc. Sometimes, however, you want to use multiple timeframes within a single test. For example, some of our strategies use a market timing rule that compares the current weekly close of SPY to the weekly closes over the past year. In this section we’ll illustrate the use of the AFL functions for manipulating timeframes.
- Functions: TimeFrameCompress, TimeFrameExpand, TimeFrameSet, TimeFrameRestore
- How to use weekly bars during a daily bar test
- Easily setting end of week/month/quarter variables
- Review TimeFrame code examples
Scaling & the Position Size Array
Scaling into trades is a powerful tool for increasing gains. In this session we will discuss how to implement a basic scaling strategy for an All Trades test.
- The 2/3/5 scale in
- Review the Scale-In Code Template
- Average entry price
- Interpreting the trade list
Exercise: Creating an All Trades Test with Scaling
This hands-on session will be devoted to executing the scale-in code template and verifying that the strategy logic is working as expected.
Simulating how a strategy would actually be traded as part of a portfolio is a big step up from simply generating trading signals or running an “all trades” test. In this session we’ll discuss money management issues like position sizing and margin, as well as mechanics like prioritizing your trade signals and limiting the number of open positions.
- Max Positions
- Round Lot Size
- Position Score
Introduction to the CBT
The Custom Backtester Interface, or CBT, is one of the most powerful tools available in AmiBroker. Writing your own backtesting code gives you an enormous amount of control over how your trading signals are executed as well as opening up a myriad of possibilities for reporting and metrics. In this section we will introduce the CBT and discuss the simplest possible implementation of a custom backtesting procedure.
- Why is it useful?
- Three levels: high/medium/low
- CBT-specific functions: SetBacktestMode and SetCustomBacktestProc
- Static Variables
- Review the High-Level CBT Code Template
High Level CBT and Custom Metrics
Using the high level CBT is a great way to implement custom metrics without having to handle the intricacies of processing all the trade signals. In this session we will discuss both per-trade custom metrics and summary custom metrics, and illustrate how those are implemented using a code template.
- Custom Trade Metrics
- Custom Portfolio/Summary Metrics
- Review the Trade Metrics Code Template
- Review the Portfolio Metrics Code Template
Exercise: Generating Custom Metrics using the Code Templates
This exercise will give you hands-on experience implementing, executing, and troubleshooting custom metrics.
Low Level CBT
The low level CBT is the go-to interface that members of Connors Research use for implementing backtests and optimizations. We will discuss the types of problems that can be solved with this construct, particularly in the context of portfolio tests, and illustrate the solutions with example code.
- Types of tasks that typically require the Low Level CBT
- Applying a custom interest rate such as T-Bill to available cash
- Portfolio test with limits and/or scale-ins
- Controlling order of entries and exits
- Rotational systems
- Review the Low-Level CBT Code Template
Exercise: Implementing a Portfolio Test with Limit Entries
In this exercise, students will implement their own portfolio test with limit entries, using the code templates provided. This mini-project will combine many of the skills used throughout the course.
The more power and flexibility that a tool provides for its user, the more opportunities there are for things to go awry. In this session we will discuss some common pitfalls that occur when doing portfolio tests with AmiBroker. As one colleague stated, “if the results seem too good to be true, I probably made a mistake”.
- Trade timing
- Looking into the future
- Implementing trading rules that are impossible to execute in real life
Additional Sources and Q&A
Total Time Estimate: 7-8 hours
This Course is for Experienced AmiBroker Programmers who are Looking to Learn Advanced Programming Skills To Improve Their Trading Results.
Sign Up Today
The cost of “Advanced AmiBroker Programming” is $1500. This course is available On-Demand. You will receive two days worth of instruction, advanced knowledge on how to backtest your strategies, along with knowledge on how to best use the CBT.
***Beginning Class in AmiBroker Programming is available.***
SPECIAL OFFER: If you would like to take both the Beginning and Advanced AmiBroker Courses together for a special discounted price of $2,000 (save $500)
Advanced AmiBroker Coding
Class Dates: On-Demand
If you have any questions, please call us directly at
888-484-8220 ext. 3, 9am-5pm ET, M-F,
(or 973-494-7311 ext 3, outside the U.S.)
About the Class Instructor
Matt Radtke is Senior Researcher for Connors Research. Mr. Radtke graduated magna cum laude from Michigan State University with a degree in computer science. He has 25 years of software development experience in companies large and small, including Hewlett-Packard and Bell Northern Research. Mr. Radtke has been actively trading stocks, ETFs, and options since 2008. Over the past several years he has become increasingly involved with the Connors Group family of companies, first as a student, then as a member of Chairman’s Club, and finally as a consultant, researcher, and author.
About Connors Research
For over 12 years, Connors Research has provided the highest-quality, data-driven research on trading for individual investors, hedge funds, proprietary trading firms, and bank trading desks around the world.
The strategies published by Connors Research are:
- Completely Original & Unique to Connors Research
You will not find these strategies published anywhere else.
- Consistent with Strategies Used by Billion-Dollar Hedge Funds
Institutional money managers make decisions based on sophisticated, computer-run analyses of massive amounts of trading data.
- Historically Validated Over Many Years and All Types of Markets
We quantify precise patterns to improve your trading decisions. Our proprietary database spans over two decades, with more than 12 million quantified trades.
- Tens of Thousands of Traders Have Relied on Our Research Over The Years
From best-selling books, like “How Markets Really Work”, to our PowerRatings subscription service, Connors Research continues to give active traders tools to achieve professional-level results.