This week we published another new course to Marwood Research called Amibroker CBT Intensive which teaches you how to use the Amibroker custom backtester (CBT).
The Amibroker CBT can be difficult to grasp at first but it offers the ability to take complete control of the backtesting process, creating your very own backtesting environment.
This opens up a whole world of possibilities from creating custom metrics and charts to advanced trade processing and position sizing.
Following are a list of 13 reasons why you should consider learning the Amibroker CBT:
1. You can add custom trade metrics to the standard AmiBroker trade list
The standard Amibroker trade list offers a handful of useful metrics such as signal date, % profit and position size etc.
However, it’s possible to include much more with use of the high-level CBT. For example, you could include in-trade metrics such as correlation, volatility or edge ratio. This way you can gain greater insight into the performance of individual trades.
2. Add custom portfolio (aggregate) metrics to the standard AmiBroker backtest report
Just as you can use the CBT to add metrics to the trade list, you can also add portfolio level metrics to the backtest report.
For example, you could include metrics such as top 5 drawdowns, T-Test or look at performance versus a random simulation.
Almost anything you can think of can be calculated and then shown in the Amibroker backtest report, giving further insight into your portfolio results.
3. Store data that can be used in custom Report Charts
Using the CBT to store backtest data also means that you can produce custom charts and graphics that can allow a more detailed visualization of your strategy performance.
For example, you could chart how certain metrics like Sharpe ratio or profit factor evolve over time. Or you could chart performance against buy and hold or random. This can give you visual insight into the effectiveness of your strategy.
4. Modify signals before they are processed
The CBT provides the ability to modify signals before they are processed in the backtest. This is useful for many tasks, for example, if you wanted to limit the number of open trades per sector at any given time.
5. Enter trades using a limit price while respecting capital limitations
Backtesting limit orders can be problematic in a portfolio simulation where you don’t know how many orders will be filled in advance. Therefore you need to have a method to limit the number of ‘orders’ each day.
Having a way to limit the number of orders each day is a task best suited to the CBT as it provides complete control over orders, signals and equity. This way your backtest will never enter trades that would not have been possible due to real-life portfolio constraints.
6. Create a hedge position
To create a hedge position effectively, it’s necessary to be able to calculate the value of all open positions on a bar-by-bar basis and have a method to initiate a hedge on a chosen symbol with a position size appropriate to the size of those open positions. It may also require ongoing rebalancing and the use of additional margin.
Such a task can only be done effectively with use of the CBT and this is covered in session 4 of the Amibroker CBT Intensive course.
7. Use dynamic position sizing methods
Many advanced position sizing methods require knowledge of the symbols which will actually be entered on a given bar/day and/or which symbols already have open positions.
Volatility-weighted position sizing is a good example where trade size can be adjusted based on portfolio or trade volatility. This is most efficiently programmed with a CBT rather than built-in Amibroker functions.
8. Rebalance open positions to a target size
Rebalancing can be done in a standard Amibroker backtest but the result is usually a ‘forced’ rebalance where positions are completely closed and then re-entered at the intended size.
Using the CBT means positions are rebalanced as they would be in real life – by adjusting trade size (without complete exit) – bar-by-bar according to specified criteria.
9. Enforce specialized stop loss and profit target exits not supported by AmiBroker’s ApplyStops function.
Amibroker’s ApplyStops function is a handy and easy way to implement simple stops but for more sophisticated options it is better to use the CBT.
For example, you could implement a “Portfolio Stop” that exits all open positions when the portfolio has lost more than X%.
Or you could implement a profit target that turns on when the portfolio has completed a winning streak of X number of trades.
10. Complete control over the order in which entries, exits, stops, rebalancing, and other functions are processed to allow accurate modeling of real-life trading
It is possible to run reliable backtests in the standard Amibroker engine but more complex systems often require use of the CBT so that trades more closely resemble a real-life environment. This is as opposed to the standard signal-trades-stats process hard coded in Amibroker.
Complete control of the backtest through the low-level CBT essentially gives traders their own ready built backtesting environment rather than relying on hard coded functionality.
11. Scale-in or scale-out of positions based on entry price or other criteria that cannot be known until a trade has actually been entered
Many trading strategies rely on scaling in and out of positions based on other positions, signals or factors happening elsewhere.
For example, a system that scales out of trades when portfolio equity drops below a certain threshold. This requires point-in-time access to Amibroker equity symbol and can be processed with a simple snippet of CBT code.
12. Implement multiple, independent strategies within a single AFL file
One of the frustrations with the standard Amibroker backtest engine is that it’s difficult to implement/combine more than one strategy at a time.
Using the CBT opens up numerous possibilities and means multiple strategies long and short can be combined into one file with equity then distributed among individual strategies as required.
This opens up the possibility of backtesting several strategies at once as well as using one file to produce exploration output.
13. Implement adaptive strategies that determine entry and exit rules at the time of trade setup
It is possible to develop simple adaptive systems with the standard backtest engine but when faced with more complex rules it is better to use the CBT.
For example, a strategy that processes complex rebalancing and entry/exit rules based on market regimes, market breadth or other composite indicators. Retrieving and processing these indicators becomes more efficient and accessible through use of the CBT.
Frequently, using the standard backtest engine becomes limiting when faced with the more flexible and powerful attributes of the CBT.
If you are interested in taking your Amibroker skills to the next level and learning the Amibroker CBT, take the Amibroker CBT Intensive course.