I tried to backtest this simple strategy on Thinkorswim and it showed profits, so I am trying to port it over to Quantconnect. The idea is simple, when the close crosses upper bollinger band, go long, with 3 ATR target and 1.5, ATR stop, and opposte for short side. However, I am having many problems (noted in the code as NOTE.)
The main problem is I want to select quarterly contracts (not first month), and just can't figure out how to do it with Universe. Tried to implement my own IDerivativeSecurityFilterUniverse, but was not successful.
So next I took an approach similar to Futures lab, where the filtering is done in OnData method. This seems to work when I debug, but every third Tuesday of the month, it comes up without any securities.
Third: my orders show trades on 6E17Q20, which has an August expiry, I don't understand why this happens, as my debugging shows that anything other than March, June, Sept and Dec contracts are filtered out successfully.
Last: my backtest shows orders stop sometime in August, even though my start date is in June and End date is in Octoboer. Even the indicators plot is empty after August. I don't know if this is due to a limitation of free account.
Appreciate any help on this.
Shile Wen
Hi Harsh,
Please simplify the code and isolate the issues to make it easier for us to identify the causes of the issues. However, to address the missing indicator values, I've moved the Plotting function out of the try catch block, and now the indicators are plotting until October. In addition, I've updated the way that the algorithm detects new days.
Best,
Shile Wen
Harsh Shah
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!