Hi there,
I'm working an algorithm on minute resolution that enters a long position on an up-trend after one red and three green candles. So far, I think I've got the position entry down (there may be some look-ahead bias…I"m not sure). However, I am having issues with closing positions on certain days. As you can see in the chart below the algo doesn't attempt to exit even though my exit conditions are met. I've been looking over it all day and am stumped as to where the problem is. Would very much appreciate someone to hold up a candle and show me what I am missing.
Best,
Ali
Varad Kabade
Hi Ali Ustaoglu,
Please tell us the days the algorithm has faced an issue in closing positions. We have made some changes to the above algorithm. We removed self.lon and adding a return statement after entering positions. This way, the algorithm won't buy and sell during the call to OnData. The backtest logs don't show any clear issues related to the ordering logic. Refer to the attached backtest for further reference.
Best,
Varad Kabade
Ali Ustaoglu
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!