I've been exploring mean reversion strategies to diversify from the trend following algos I tend to trade and came across ideas at Quantified Strategies – Quantitative analysis and strategies in the financial markets. I tried one that looked promising, the 4th strategy from here: 10 Free Swing Trading Strategies That Work (Backtested Buy And Sell Signals) – Quantified Strategies
It's an internal bar strength (IBS) mean reversion strategy on QQQ and the author's backtest in Amibroker shows a 15.1% CAGR and 28% drawdown. When I replicate in QC, I get a 5.5% CAGR and 33% drawdown. Am I doing it wrong? Is Amibroker wrong? Or worse, is the author misrepresenting the strategy (that would seem doubtful since it's so easy to replicate)?
Louis Szeto
Hi Tristan
There could be multiple reasons for the discrepancy.:
LEAN uses adjusted price in default. It is possible to change that by including the following line in Initialize method:
LEAN has a default brokerage model for reality modeling. Most strategies would turn profitable to losing after commission. It is possible to implement a custom fee model for your own need.
In minute resolution you were using, level 1 bid-ask price data are available for equities in LEAN. Thus, buy order would be using ask price, and sell order would be using bid price to fill, in order to account for the effect of slippage. It is possible to implement a custom fill model for your own need.
You could download the orders from Amibroker and LEAN for comparison.
Best
Louis
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.
Alexandre Catarino
Hi Tristan F ,
Since you have used data from Yahoo that doesn't include L1 data, it's likely the source of the performance difference. You can implement a custom fill model that sets the fill price with the value of the security price:
to validate the results. However, as Louis' mentioned, you should compare trade by trade to verify whether this implementation generated the same orders.
Tristan F
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!