Category Archives: multiple strategies

Backtest Multiple Strategies

If you are serious about trading and/or investing and are willing to commit a good amount of your net worth, you may choose not to follow just one strategy. You may be better off splitting your capital amongst not just different asset classes or stocks or etfs but also different strategies that trade those assets.

How can we simulate this?

One way is not to. You can develop good strategies independent of one another and invest in them as you see fit.
The other way is to simulate a multi-asset, multi-strategy portfolio as a whole.

You can think of a strategy as a time-series. SPY is a time-series. So is GLD, so is IBM. Just a sequence of numbers. So a strategy is it’s equity curve, an artificially made time series. You can invest in one or in multiple ones, just as if they were “assets” also.
20 years ago we should have diversified in different asset classes, now we may have to diversify in different strategies, as well.

So how can you do that? What tools to use?
There are many choices. I will briefly go through the ones I have tried. Others exists that might be better but I haven’t tried myself (NinjaTrader, TradingBlox, etc.)
_______________________________________________________________________________

  Amibroker

As you know I am a big fan of Amibroker. It is not an obvious choice for backtesting a multi-asset, multi-strategy portfolio. But as usual there’s many ways to do things in AB. The obvious choice is to backtest each strategy and export the individual equities. Then trade those equity curves as buy & hold. The downside is that it takes two steps to do this. The upside is that you can write a new script and develop rules or allocation schemes on when and how much to trade in each strategy. Another choice is to program multiple strategies in one afl script, so that both available funds as well as compound profits are taken into consideration.
This  can be done, with some limitations. If someone is interested, I can do a post with the afl code and logic.
________________________________________________________________________________

The more I work with this software, the more I like it.
In QuantShare, you first develop individual strategies. Each can trade it’s own specific basket of assets.  You can then combine strategies by using the combine-trading-systems plug-in.
 It asks you to choose which strategies to test, then combines them and returns stats and equity curves. By listing the stats of all the possible combinations, you can quickly see which combinations of strategies are better without going through a correlation analysis.
Another way to backtest multiple strategies is to write a MoneyManagment script. Using such a script (in C# or JScript) you can control multiple “categories” that have their own rules.
In the next post I will go briefly through an adaptive multi-strategy script.

_______________________________________________________________________________

I downloaded a 30-day trial and so far I am very impressed, especially with the ease it communicates with Interactive Brokers (as well as many other brokers and feeds) and the potential to run ATS (automated trading strategies) with many different brokers. I was able to set up a simple ATS system in less than 10 minutes and run it. This is definitively a contender when it comes to intra-day ATS systems.
That said, MultiChart can also backtest multi-strategy,multi-assets portfolios.

________________________________________________________________________________

Now, this is a very interesting piece of software.
a. You can perform multi-asset, multi-strategy backtesting by using “Accounts”. Each Portfolio has one or more accounts. Each account has each own instrument list, strategy, money managment script, as well as commissions and broker connection (for autotrading).
b. You can have a Master money managment script that “sees” all accounts under the portfolio and reallocates funds according to set rules.
c. You can have a Master risk-controlling script that “sees” all accounts and ,for example, rejects positions if different strategies tend to buy the same one stock. You can automate all this, not just backtest. As an exampe: Let’s say you have two brokers: Interactive Brokers and MB Trading. Under Portfolio I can create two Accounts: InteractiveBrokers_1 and MBTrading_1. Both can be auto-traded from IQ.  So even if you are a bit paranoid and don’t trust your broker,  you can execute through them only half your strategy! 🙂
e.IQBroker uses C# and allows you to import dll references.
f. It’s currently free for individuals.
So, what’s the downside?
A bit of a steep learning curve and no support (unless you pay).