Hi, could somebody explain to me behavior of this 5-line script?
- I place one MarketOrder to buy 1 share of Microsoft
- Then I place one StopMarketOrder to sell 1 share of Microsoft if pricehits $1000
- Price never hits $1000 but two orders get filled, WHY???
Why stop market order acts like market order???
Anybody?
Artemiusgreat
Ok, I think I figured it out, in a perfect world I should be able to use LimitOrder and StopMarketOrder from the both sides of the price, but in a world of QuantConnect I can use LimitOrder as a Take Profit only, and StopMarketOrder as a Stop Loss only. Just in case, I think it is a bug, because if I can't use Limit Order as a stop loss it means that on a fast market with limited liquidity I can't actually limit my losses, my position will be closed way below the price that I set. Surprise.
Attached another simple script that shows working example with SL / TP. If somebody will try to exchange StopMarketOrder and LimitOrder in this script you willl see that they will silently ruin your strategy by executing as a Market Orders. They won't even show any info about execution, they just turn from Limit and Stop to Market immediately.
Derek Melchin
Hi Crypto Hai,
Refer to this related thread for assistance setting up TP & SL orders.
Best,
Derek Melchin
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.
Jake Sehnert
Thanks for asking this question - it's absolutely crazy to me that QC still hasn't added functionality for handling simultaneous limit order to take-profit and stop-loss. StopMarket/Limit orders are by no means the same.
Derek Melchin
Hi Jake,
We must use a stop order because it's not possible to place sell limit orders on both sides of the order book without one being immediately filled. The stop order can be either a StopMarketOrder or a StopLimitOrder.
Best,
Derek Melchin
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.
Artemiusgreat
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!