I set the basic script below to take trades from first of August 2020 to end of September 2020, but when running the backtest in the console I can only see trades till the third of August. There are no specific entry criteria so there should always be conditions for a long trade. I also noticed that in the last few trades both my sell limit and sell stop market orders are getting filled simultaneously.
Louis Szeto
Hi SIG_94
The problem is you're using Hour resolution, so the order will not be filled as the way you wish: it will fill at the end of that hour if you stop/limit price is within in that bar's high/low. So at a certain point, it is easy to fill both the stop loss and take profit order together, making the self.Portfolio.Invested always True later (you did one more additional sell short order) and no more trade happened after that. You can use minute/tick resolution for more accurate results and solve your filling problem.
Also in line 37 I think you mean
Cheers
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.
SIG_94
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!