Hi everyone!
We created the Donchian Channel breakout strategy (sourced from Raposa.trade) that @undershot mentioned in the QC Discord. This strategy buys when the stock closes above its trailing 20-day high and sells when the stock closes below its trailing 20-day low.
Following the original research, this strategy trades XOM and outperforms buy-and-hold. Since it only trades one asset, it likely suffers from stock selection bias. To develop this algorithm further, consider testing this strategy on a universe of Equities or another asset class.
Best,
Derek Melchin
Want to invest in QuantConnect as we build the Linux of quant finance? Check out our Wefunder campaign to join the revolution.
Axist
Really cool! This would seem like doing the same thing as something like this correct?
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.
Derek Melchin
Hi Axist,
Very close! If we wanted to use Min/Max indicators, we would need to add a delay period via indicator extensions.
Otherwise,
and
would always be false. The Donchian Channel indicator has this delay built-in.
See the attached backtest for reference.
Best,
Derek Melchin
Want to invest in QuantConnect as we build the Linux of quant finance? Check out our Wefunder campaign to join the revolution.
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.
PaleMountainBird
Hi,
I'm a new user and still finding my feet. I've tried cloning Derek's DonchianChannelBreakout script but can't seem to getting working in the backtest. The script runs without errors but the backtest returns no trades and a flat equity line. I've tried swapping out the original “XOM” ticker for “SPY” and “QQQ” but get the same results. I'm sure the answer is something simple that I can't yet see and would be grateful if more experienced eyes could point it out.
Thanks!
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.
Ashutosh
Hello PaleMountainBird
There is a small logic error in the implementation of the code.
DCH indicator runs with a simple logic design:
UC = Highest High in Last N Periods
Middle Channel=((UC+LC)/2)
LC = Lowest Low in Last N periods
When you check the condition:
here self.indicator.UpperBand.Current.Value is updated with the latest value and when we check the condition it returns a boolean false everytime resulting in no trades.
A simple way to correct the logic is to store the value of "self.indicator" in a variable as previous value and then check this with the current close price. This will give you a correct backtest that will match the original backtest attached by Derek.
Check the backtest out and let me know your reviews!
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.
Ashutosh
Hello PaleMountainBird
There is a small logic error in the implementation of the code.
DCH indicator runs with a simple logic design:
UC = Highest High in Last N Periods
Middle Channel=((UC+LC)/2)
LC = Lowest Low in Last N periods
When you check the condition:
here self.indicator.UpperBand.Current.Value is updated with the latest value and when we check the condition it returns a boolean false everytime resulting in no trades.
A simple way to correct the logic is to store the value of "self.indicator" in a variable as previous value and then check this with the current close price. This will give you a correct backtest that will match the original backtest attached by Derek.
Check the backtest out and let me know your reviews!
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!