Hi, my code is rather simple with a simple market order (+500 shares) followed by a stop limit order (-500 shares) with no stop/limit price updates:
self.StopLimitOrder("TSLA", -500, 0.98 * self.Securities["TSLA"].Close, 1.04 * self.Securities["TSLA"].Close)
This is with the goal of cutting losses at 2% as well as capping gains at 4% of the initial price (i.e. sell if either condition is met), however I am not sure why the order is never getting filled despite dropping below 98% during the period. Any advice would be greatly appreciated - the docs only have limited information on these types of orders. Thank you in advance!
Mislav Sagovac
My guess, is that you set a limit order when the price hit 98% of price_t, but it doesn't come back to 104% price of price_t?
I didn't try to run the code, but from the graph, I can see the DD goes down almost. linearly.
Vladimir
Alex Ding
Try this way.
If you are satisfied with my answer, please accept it.
Alex Ding
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!