Hi all,
I've seen this issue been raised a few times before, but have only seen one “solution” to it. The issue I'm referring to is when you buy a position and then set a limit order (take-profit) and a stop loss order, and then the position moves enough in that one minute that it should execute the sell, but since its in the same bar as the buy, it doesnt execute the sell and then you get stuck in the position. I put quotations around solution because the only answer I've seen is that once you make the algo live, then those orders follow the ticks, so this issue doesn't occur. However, I don't want to pay for a live trading node to test this just to find out that that wasn't the fix in the end. Could somebody confirm that there is no way to get around this in backtesting and that it will fix itself in live paper trading? Or is there something else I can do to make the code more secure and be able to catch this? I feel like ideally I should be able to have the OnData() method track the current AskPrice and then just make decisions based off of that, but I am working with options and cant figure out how to send the specific option contract into the OnData method to track its live prices. Thank you in advance for the response(s)!!
Louis Szeto
Hi Jclute17
Sorry for the delay. Filling of outstanding orders does not depends on the data density in reality/live trading, but the realtime market movement. Thus, you won't get stuck in the position by this reason. Warm reminder that if you're trading with illiquid security, you might still be locked since there aren't enough market participants.
Best
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.
Jclute17
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!