Hi everyone,
first of all thanks for this great community! I don't know what I'd do without you!
For a few days now I'm stuck with a strange filling behaviour of the stop loss order for my short put strategy. I'm selling one position at a specific signal and setting up a take profit at 50% and a stop loss at -100%. The take profit without the stop loss works fine. But the stop loss is triggerd and filled at an option price that was never relevant in the given time frame.
I compare my results with ThinkOrSwim. But additionally I plotted the highs and lows of the option price into an extra chart in QuantConnect as well ("Option Prices"). And even QC itself is telling me that the stop loss shouldn't be triggered.
Let's put all that into numbers!
- On the 10th April 2023 I'm selling a put (MSFT 12May'23 260 Put) for $2.36.
- The take profit is at $1.18 (50%).
- And the stop loss at $4.72 (-100%).
- On the 13th April the stop loss is triggered at a price level of $4.72.
- But having a look at the chart “Option Prices”, you see that in the whole time frame the highest price of that option was around $3.0. ThinkOrSwim validates that maximum.
Can somebody please help me understand what I'm missing? Thanks!
Louis Szeto
Hi Christian
The code seems fine. One of the possible reason would be some extreme quotes at market opening hours by market makers, since LEAN took quotes to fill options. You might implement SpreadExecutionModel to avoid this.
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.
Christian Reschke
Hi Louis,
thanks for the quick answer! I'll try that and will let you know. ;-)
Regards
Christian
Christian Reschke
No, no luck with SpreadExecutionModel.
Louis Szeto
Hi Christian
Sorry my bad, the SpreadExecutionModel does not work on options. Yet the issue I raised was indeed where the problem laid. When you look closely, the stop loss order was filled at 9:31 of 13/4/2023, where there was an extreme quote of $10 there.
Another way to solve that would be filtering the data where the bid-ask quotes are too extreme. See the attached backtest implementation as an example.
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.
Christian Reschke
Hi Louis,
that's really making my day! I accessed the quote data not correctly to draw it into the chart.
Thank you so much!
Christian Reschke
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!