In this post I talk about two high quality courses where you can learn how to use the immensely powerful trading simulator Amibroker.

* If you intend to take either of the two courses below (or both), use the discount code ‘Marwood’ at checkout to receive 15% off the usual price. *

Regular readers of this blog will know that my back testing and trading software of choice is Amibroker. It is an incredibly quick and flexible platform, easy to use and comes with awesome support. In fact, when you purchase Amibroker you are entitled to 24 months support from the developers – something that I’ve really benefitted from.

Regular readers will also know that every now and then I talk about a product or two that I believe is worthy of recommendation. And sometimes I earn a small commission from doing that and sometimes I don’t. The main point being that I never recommend a product that is a scam or offers little value to my readers.

Learn Amibroker at Trading Markets

Now, as I said already, Amibroker is my favourite tool for analysing the markets and I have found it superior to the vast majority of much more expensive programs.

However, Amibroker is still just a tool. It is immensely powerful but only if you are able to learn Amibroker in the right way.

Previously, in order to learn Amibroker, Amibroker users have had to pretty much teach themselves. When I was learning the program, I basically had to make do with Amibroker forums and Dr. Howard Bandy’s books (which isn’t to criticise any of those because they are excellent).

It just would have been a lot easier and quicker if there had been some way to sit down and learn everything in one go.

And that’s why these 2 new courses from are so valuable. They allow beginners to learn Amibroker from the ground up, doing it the right way.

Right now, there are couple of places still available I believe, which will have you fully up to speed, ready to build high performing trading strategies in just a couple of days.


Before I go into more detail about the two courses it’s worth saying a word or two about because they’ve been involved in the financial markets for quite a while. In fact, TradingMarkets were founded back in 1999 by Larry Connors and Kevin Haggerty, and if you think you’ve heard those names somewhere before it’s probably because you have:

Larry is the author of a number of bestselling finance books including Short Term Trading Strategies That Work, High Probability ETF Trading and Trading Stocks and Options With Moving Averages. He’s also famous for developing the ConnorsRSI technical indicator and is regularly featured on CNBC and Bloomberg TV.

learn amibroker trading markets teamTrading Markets TeamWhilst Kevin was a former head of trading at Fidelity Capital Markets in Boston where he was responsible for all U.S. institutional Listed, OTC and Options trading. It’s fair to say that the team at TradingMarkets have a wealth of knowledge at their disposal, and in Matt Radke, they also have a teacher with a huge amount of technical experience.

Introducing Programming in Amibroker – Learn How to Backtest Your Best Trading Ideas in One Day

The first course from TradingMarkets, taught by Matt Radke, starts on the 5th June and is your introduction to using Amibroker. It’s taught over the course of one day and consists of 6 hours of interactive online learning. It includes the ability to talk with Matt directly, download a number of AFL code templates and involves several hands-on sessions where you can get to grip with the software.

During the course you’ll learn:

• How to import data correctly
• How to use the automatic analysis window
• How to code in AFL (Amibroker Formula Language)
• How to scan
• How to run an exploration
• How to code and add custom indicators
• How to perform back tests

You also receive free:
Quantitative Trading Systems by Dr Howard Bandy (book).

What else?

The best thing about this course (and the one below) is that they are taught by experts in Amibroker. Connors Research and Trading Markets use Amibroker daily to build their own high performance trading strategies so they know exactly what it takes to teach others.

The introduction to Amibroker will leave you with real confidence in your ability to program indicators, run scans and create profitable trading systems. At $1000, it’s not cheap, but it’s not that expensive either. Especially when you consider the potential rewards from running your own systems.
For more information about the course, and to book your place, click on the banner below and you’ll be taken through to the course booking page.
Learn Amibroker Introduction to Amibroker course

Advanced Amibroker Coding – 2 day course

If you are already fairly experienced in Amibroker, or if you have taken the Introduction to Amibroker course, and you want to advance your knowledge to expert level then the 2 day course of Advanced Amibroker Coding is going to be your best bet to learn Amibroker.

This course runs over two days and covers everything you will need to run your high grade strategies and harness the full working power of Amibroker.

Specifically, you’ll learn how to use the often misunderstood Custom Backtester (CBT) interface which will allow you to create complex backtests, optimizations and portfolio simulations.

During the course you’ll learn:

• When to use the three levels of Custom Backtester (CBT)
• How to add custom metrics to the CBT
• How to utilise multiple time frames
• How to design for a portfolio
• How to perform optimisations correctly

In addition you’ll learn:

• Advanced functions such as LOOP, LOOKUP & _TRACE()
• Using the Switch function
• TimeFrame Compress/Expand and Set/Restore
• Scaling and position size array
• High level and low level CBT
• How to implement a portfolio test

As well as this, the course goes over the mistakes traders make when designing systems and how to best avoid them. By the end you should be able to produce historical results for a system that mimics exactly the way you want to trade and thereby gain insight into how the system will stand up in the future.

The course, again, is taught by experienced Amibroker programmer Matt Radtke and is an intensive, hands-on couple of days with lots of examples and exercises. As I said before, if this was around when I was first learning Amibroker I would have snapped it up, it probably would have saved me several years of trial and error learning.

For more information, check out the full Amibroker courses below:

Remember to use the code ‘MARWOOD’ to get a 15% discount at checkout.

The term ‘quant’ or ‘quantitative trading system’ conjures up the image of a smart math graduate on the desk of an investment bank who spends their time creating sophisticated short-term algorithms. Such algorithms that pull millions of dollars from the market in a blink of an eye.

However, and though there are many of these types of quants, anyone who uses a mathematical, objective approach can also be called a quant.

So what are quantitative trading systems?

A quantitative trading system can be defined as any system that uses mathematical computations in order to make trading decisions. In finance, this is hugely beneficial for many reasons. Firstly, using a quantitative trading system means you can test your ideas objectively on past data and therefore come to conclusions about how those ideas will fare on real, future data. Some of the most successful hedge funds utilise quantitative methods to some degree. For a good example just take a look at Jim Simons whose Medallion fund has averaged 35% returns since 1989.

Quantitative trading systems close up image

Secondly, quantitative trading systems can be statistically verified and tested.  They can also be used to make instant, complex calculations that a human trader might not be able to.

Another advantage of using a quantitative trading system is that you can eliminate some of the human emotion involved in trading.

However, there is an important point to be made here because a trading system can never fully eliminate all of the emotion involved.

Indeed, in some cases, emotions merely get transferred to the system itself, rendering it useless.

This can happen in any number of ways; jumping on and off of the system, creating a system that it is not robust, curve-fitting the system to past data, ignoring the system or second-guessing the system’s signals…

Psychology is thus hugely important, even for quantitative traders.


One good book on the subject of quantitative trading systems is Ernie Chan’s Quantitative Trading: How to Build Your Own Algorithmic Trading Business. It’s particularly good because it contains some of Chan’s original ideas. Some of these are hard to implement and require sophisticated technology but some are simple, such as Chan’s system that seeks to take advantage of earnings drift.

Another good book on the subject is Quantitative Trading Systems by Dr Howard Bandy. This is a pretty good book on how to design a trading system, and it gives plenty of examples, though it is expensive and its mainly geared to Amibroker users.

And then there is my book which contains 20 systems, all of which are tested on 10 years of stock market data and provided with a number of performance metrics. They’re a mix of trend following and mean reversion systems and are mostly based on weekly timeframes.

20 quantitative trading systems:

System 1: Moving average crossover

System 2: Four weeks up in a row

System 3: Trading the noise

System 4: Trading the noise plus shorts

System 5: Trading gradients

System 6: Dollar cost averaging

System 7: Donchian style breakout

System 8: Breakout with EMA confirmation

System 9: Trend following with the TEMA

System 10: Bull/ Bear fear

System 11: Simple RSI with equity curve filter

System 12: The range indicator (TRI)

System 13: Volatility breakout with Bollinger Bands

System 14: Trading the gap

System 15: RSI with the VIX

System 16: Trading the TED

System 17: Simple MACD with EMA filter

System 18: Cherry picking penny stocks with EMA crossover

System 19: Using the Commitment of Traders (COT) report

System 20: Finding cheap stocks with linear regression and average true range

link for my book how to beat wall street


afl for amibrokerThe best resources for Amibroker AFL can be found via the Amibroker AFL library or one of the Amibroker user forums. Here there are usually plenty of generous traders who are happy to share some of their code and give assistance if needed.

I also provide plenty of free AFL code here so make sure to come back regularly.

New to Amibroker?

Luckily writing AFL for Amibroker is fairly straightforward even for someone with no background in programming. If you are new to Amibroker I will recommend a piece of advice that I first received when on the Amibroker forum:

Start off with end of the day data for US stocks and look for simple, robust systems.

Everything you need from a good trading system can be found with EOD data and from here it should be possible to reach returns of 30% CAR a year with a little bit of work. From there you can start to work on even greater returns but remember higher returns will inherently mean higher risk.

By end of day data I mean data that shows the high, low, open, and close from the trading day. It’s far better to concentrate on daily or weekly systems and ignore day trading if you are new to the markets.

And remember, no trading system can be created without good quality data. I recommend Norgate Premium Data and you can get a free trial of the service here.

Writing AFL for Amibroker

When you start writing Amibroker AFL it’s a good idea to begin with a kind of template that you can then use as the basis of several trading systems. I usually start off with something like this, (the set options can also be set in the Amibroker panel but it’s better to write them into the code):

SetOption( “InitialEquity”, 10000);

This one sets how much capital you have to trade e.g. $10,000

SetOption( “UsePrevBarEquityForPosSizing”, True );

Allows position size to be calculated using % of previous bar’s funds. Can be turned on or off

SetTradeDelays( 1, 1, 1, 1 );

It’s usually not possible to trade on the exact moment that a signal occurs. So you can delay the buy, sell, short and cover entries by 1 (or more) bars.

SetOption( “MaxOpenpositions”, 10);

Sets the Maximum open positions you want at any one time. I’ve set mine at 10 as I trade a portfolio of 10 stocks.

SetOption(“SeparateLongShortRank”, True );

Amibroker enters trades based on the signal rank also known as positionscore. If you hold short and long positions this variable allows them to be ranked separately so you dont end up favoring one direction over the other.

SetOption (“Maxopenlong”,MOL);
SetOption (“Maxopenshort”,MOS);
MOL = 10;
MOS = 5:

This code allows a maximum of 10 long positions and 5 short positions at any one time.

SetOption( “AllowSameBarExit”, True );

Allows trades to be closed on the same bar that the exit signal or stop signal occurs

Numberpositions = 10;
SetPositionSize( 1, spsShares );
PositionSize= -20/10;

This is the segment of code I use to set my positionsize or risk. -20 / 10 means my position size per trade is 20% of my account divided by 10.
In other words, if I start with $10,000, my first trade will have a stock value of $200. To get the number of shares, you simply divide this number by the stock price. Eg, for a stock that is $12, I will buy 16 shares.

Ranking trades

Once that’s in place it’s a good idea to define positionscore metrics and enter the formulas for any indicators you plan to use. Remember, positionscore determines the rank. If you have more than one trade signal, Amibroker will take the trade that is scored the highest. This is quite important, particularly if your system generates lots of signals on the same day/ bar. You can use any calculation you like. Here are some ideas:

PositionScore = RSI(14) – 100;       Prefers long positions with lower RSI values and short positions with high RSI
PositionScore = ATR(10) – 100;     Prefers long positions with smaller ATR (average true range) values
PositionScore = ROC(C,1) * -1;       Prefers long positions with lower ROC (rate of change) values 

Then you can enter your buy and sell conditions. When you write AFL for Amibroker it’s a good idea to keep everything organised so that you dont make any mistakes and you can easily understand it in the future. Here’s a very simple moving average crossover example:

fastema = EMA(C,50);
slowema = MA(C,200);

Buy = Cross(fastEMA,slowEMA);  Buys when the 50 period EMA crosses over the 200 period EMA.
Sell = Cross(slowEMA,fastEMA);   Sells when the 200 period EMA crosses under the 50 period EMA.

Once you have tried this, you can set about optimising some of your parameters like below:

fastema = Optimise(“fastEMA”,50,25,200,25);
slowema = Optimise(“slowEMA”,200,180,300,20);

When run, the optimiser will cycle through these values and present them in a table showing which ones performed the best. The numbers in brackets stand for (default setting, first iteration, final iteration, step). In other words the optimizer will first test the fastema with using the ’25’ setting, it will then keep testing at intervals of 25 until it gets to 200 where it stops. If you run the backtest without the optimiser, Amibroker uses the default (50) setting.

After your buy and sell conditions you can enter code that plots your various indicators on the chart and any calculations that you may have with the equity curve.

For more code be sure to check back here regularly as I plan to post several trading systems – analysed and presented with the AFL for Amibroker.

It’s also a good idea to check out the resources from Amibroker for back-testing and portfolio testing here.