The meta-strategy tool is a new powerful QuantShare tool introduced few months ago. Simply put, a meta-strategy is a trading system that trades multiple trading systems.
The ability to combine, backtest and optimize several trading systems and turn them into a single one is the main purpose of the tool. You will be able to add as many trading systems as you want, set a different weight for each one, trade different strategies equity curves as they were assets, create advanced money management scripts for your meta-strategy and so on.
Let us get started now by creating our first meta-strategy. Obviously, the first thing you need is to have a set of different trading systems that we will use in our new global system.
If you are new to QuantShare and still don't know how to create a trading system then I highly recommend you take a look at the following blog post:
The Ultimate Guide to Create Trading Systems in QuantShare
Select "Analysis" then "Meta-Strategy Simulator". The simulator control is similar to the trading system simulator (Analysis -> Simulator).
Click on "New" at the top to open the meta-strategy editor. The first tab (Meta-Strategy) is the most important one and there you can specify all the important meta-strategy settings.
First, click on "Add/Remove Trading Systems". To select multiple systems, just check each system that you want to include. Click on "Load Checked Item(s)" once done.
Each strategy will have its own row. The second column (Relative Weight) is editable and there is where you can set up the relative weight of each strategy.
Say we have added 3 trading systems:
If you keep the default relative weight for each strategy then our meta-strategy will be invested approximately 33% in each system.
Now say we update the relative weight and put these values:
St1 => 0
St2 => 1
St3 => 4
The first system "St1" will be ignored.
The calculation of the percentage to invest in each strategy is done as follow:
The application sums the different weights (0 + 1 + 4 = 5) then invest the following percentage in each one (Weight / Total).
St1 => (0 / 5) = 0%
St2 => (1 / 5) = 20%
St3 => (1 / 5) = 80%
Under the trading systems grid, you can select the rebalance frequency. If you select a Monthly rebalance frequency then the meta-strategy will adjust the amount to invest in each strategy on monthly basis so that it meets again the initial weights.
Back to your previous example:
St2 => 20%
St3 => 80%
If after few days, the system "St2" return increases while "St2" return decreases, we may end up with something like this:
St2 => 22%
St3 => 78%
On the rebalance day, the meta-strategy will sell some equity (scale-out positions) of the "St2" system and buy some equity (scale-in positions) of the "St1" system so that the new weights become approximately:
St2 => 20%
St3 => 80%
One of the most exciting features of the meta-strategy simulator is the ability to test different trading system combinations.
If you have 10 trading systems and would like to check which combination of four systems would perform best then all you have to do is add these systems in your meta-strategy, check "Optimize Strategies Selection" at the bottom, select the number of trading systems or strategies to include then optimize your meta-strategy.
You may also want to have a fixed number of trading systems then optimize the remaining ones. To do this, check the "Optimize Strategies Selection" option then check the trading systems that you always want to invest in. These checked systems will not be included in the optimization and will always be invested in your meta-strategy.
Besides optimizing strategies selection, you can also optimize the relative weight of each of your systems. To do this, simply add two or more relative weight numbers separated by a semi-colon.
St1 => 1;2;3
St2 => 1
The above example would perform three backtests if optimized.
St1 => 1 (50%)
St2 => 1 (50%)
St1 => 2 (67%)
St2 => 1 (33%)
St1 => 3 (75%)
St2 => 1 (25%)
Click on the "Strategy" tab at the top. There, you will find a formula editor such as the one you are using when creating single trading systems.
Implementing buy/sell/short/cover rules for a meta-strategy is considered advanced stuff and is not mandatory.
By default, the meta-strategy will invest in every strategy given the relative weights you previously specified. This is why the default rule is:
buy = 1;
There is no sell rule since by default you are invested all the time in each strategy.
Now, if you want to trade based on the system equity curve and invest selectively in your trading systems, you can define here your own buy and sell rules.
Here is a very simple example:
buy = perf(close, 10) > 0;
sell = perf(close, 10) < 0;
// Invest in a trading system only if its 10-bar return is positive and sell all positions of that trading system if its 10-bar return becomes negative.
If you want even more advanced stuff, you can create your own money management script for the meta-strategy.
There is just one important thing to keep in mind. When dealing with the meta-strategy, just substitute securities with trading systems. A security close price becomes a trading system equity curve. That is the most important thing to know.