Managing risk of loss is important for a winning strategy. In this research, we are going to evaluate some popular risk control methods. We will test that given a strategy if adding some common risk control mechanisms can help ensure against losses in a stock price either in the range-bound market or trending market. Then we will compare the risk-adjusted performance and the performance of strategy without risk control.
The base strategy we want to control the risk is the simple MACD strategy. The basic function of the MACD indicator is to discover new trends and to help identify the end of current trends. The MACD indicator typically comes with the default parameters 26, 12, and 9, which is the settings in our strategies.
- Buy Signal: the MACD line crosses the slower signal line in the bullish direction
- Liquidate Signal: the MACD line crosses the signal line in the bearish direction
Method 1: Trailing Stop
This method means a sell stop order sets the stop price at an amount below the market price. Here we set the amount to be the lowest low in the history close of last one month(22 days). The purpose of the stop is to protect against a move by the stock price in the opposite direction than what we expect. In this strategy, all the others being the same with the base MACD strategy like the parameters and the trigger condition of the buy signal, the only difference is that a stop-loss order is placed when the market price is below the lowest low in the last 1 month.
Method 2: Protective Put Options
A protective put option is like an insurance, the purchase of protective puts increases the cost because of the premium we pay to buy the put. Our strategy here is when the MACD generate the sell signal, buy a put option to protect a short-term downward move in the price. If the MACD sell signal is right and the stock falls, the put options will cover the losses below the strike price. In this method, all the others being the same with the base MACD strategy like the parameters and the trigger condition of the buy signal, the only difference is that when the MACD indicator generates a liquidate signal (We assumes the MACD sell signal implies an upcoming downtrend in stock price in the short term), instead of liquidating the positions in basic MACD strategy, we buy an put option which is about to expire in a month to protect the downside move.
Experiment Implementation
Our backtesting period is from 2015-11 to 2017-11. The equities we use to test the risk control strategies is IBM and SPY. During these two years, IBM price is volatile and rose about 35% in 2016 and then lost 25% of its value in 2017. In contrast to IBM, SPY rose about 40% in the last two years. The backtest results are as follows(Click the link to see the equity curve and the code)
IBM Experiment Sharpe Ratio Drawdown Alpha
Control Study 0.611 3.8% 0.013
Trailing Stop 0.6 7.2% 0.014
Protective Put Options 0.638 3.8% 0.014
SPY Experiment Sharpe Ratio Drawdown Alpha
Control Study 0.97 32.5% 0.011
Trailing Stop 1.483 4.2% 0.026
Protective Put Options 0.671 3.2% 0.001
From the result above, the performance trailing stop method is worse than the control study(The original MACD strategy) here for IBM, we thought the trailing stop can fail as a loss limitation tool because hitting the stop price triggers a sale but does not guarantee the price at which the sale occurs. The MACD sell signal tries to capture the turning point of the uptrend, but our sell stop loss order tries to liquidate the positions at a lower price which limit the price. For uptrend SPY, the Sharpe ratio and alpha for trailing stop strategy are the highest among three strategies as the sell stop loss order only being placed three times during the whole backtesting period. But whether the trailing stop will help control the risk in winning strategies still depends on which kind of stop-loss order you use and how you judge the trend of the market in the short term and the long term.
The protective put options perform better for both IBM and SPY compared to the control study strategy. It is an effective tool to protect the short-term losses (Here we choose the at-money-options which expire within one month).
The attached research notebook is trying to generate the equity curve of the original MACD strategy and the trailing stop strategy and visualize the buy and sell signals using charts. You can change the date range at the last chart to check all the signals in stop loss and MACD strategies.
Newoptionz
Hi, the notebook has been removed, anyone have the code for this ?
Alexandre Catarino
Hi Newoptionz ,
Thank you for your patience.
The technology that supported that notebook was deprecated, Unfortunately, we cannot get it from the original post: it is lost.Â
Jing Wu
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!