The idea consists of turning a trading system on and off based on its equity curve. For example, you can turn the strategy off when it drops below a certain level, reaches a low or crosses below/above its moving average.
Let us say you create a trading system that enters long when the RSI is overbought and exits any existing position when the RSI is oversold.
After backtesting your strategy, you notice that the strategy's drawdown is too high and thus decide to implement a mechanism that turns the strategy off (stops investing in that strategy)
when the drawdown reaches -15% and then turns the strategy on when the drawdown become higher than 15%.
The meta-strategy tool of QuantShare would allow you to implement such idea very easily. Let us see how.
First, let us create the initial trading system.
- Select "Analysis -> Simulator"
- In the simulator manager, click on "New" then select the "Strategy" tab at the top
- Click on the "Create trading system using the formula editor" tab at the below panel
- Enter the following formula:
buy = rsi(14) > 70;
sell = rsi(14) < 40;
// Enter long when the Relative strength index is above 70 (overbought) and sell when it is below 40 (oversold)
- Select "Symbols & Dates" tab then define the securities to include in the simulation as well as the simulation start and end dates
- Click on "Create Trading System" then name it "TEquity1" for example.
- In the simulator manager, click on the "Simulate" button at the top
After the trading system report is displayed, you can see the equity curve at the bottom displayed in a chart.
To learn more about how to create trading systems, please check this blog post:
The Ultimate Guide to Create Trading Systems in QuantShare
In order to trade this equity curve, we need to create now a meta-strategy.
- Select "Analysis -> Meta-Strategy Simulator"
- Click on "New" then select the "Meta-Strategy" tab
- Click on "Add/Remove Trading Systems", check the "TEquity1" trading system then click on "Load Checked Item(s)"
- Click on the "Strategy" tab then type the following formula:
d = drawdown() * 100;
buy = d > -15;
sell = d <= -15;
// Since this system will trade the "TEquity1" equity curve, it will instruct the simulator to invest in the strategy only if its drawdown is above -15%
- Click on "Create Meta-Strategy" then type a name
- In the meta-strategy manager click on "Simulate" to backtest the meta-strategy
In this basic example, we have included just one trading system in the meta-strategy but of course you can add as many as you want. You can create advanced logic and also implement money management scripts in C# (as you would do with a simple trading system).
To learn more about the meta-strategy tool, please check this blog post:
How to Create Your First Meta-Strategy