Back

Market Range Orders?


Is it possible to conduct range orders as defined below? I see a few different Buy methods, but I'm not seeing exactly how I can do this.

Market Range Orders

This order type allows you to set an acceptable price range (in pips) to execute market orders. If your order cannot be filled within the range selected, the order will be canceled and no trade will be opened. So this limits the amount of slippage your order could face. The wider you set the range, the more likely the order will be filled. To learn more about market and market range orders, click here.
Update Backtest








To further clarify, is it possible and if so, how can I make a Fill or Kill Limit Order? Looking under the hood of QCAlgorithm.Trading.cs, It doesn't seem like I can from any overload nor does the Tradier API documentation suggest a way to do this. How would you recommend I go about this?
0

Fill or Kill orders (and other exotic types) are not universal and are supported on a brokerage-by-brokerage basis so we haven't built them into LEAN yet. The closest potential solution would be placing a limit order above the market price - which effectively meets your "acceptable slippage" requirement, but it won't do the fill-100%-or-kill nature.

Even placing a limit order above the market price is supported on a brokerage by brokerage basis (IB/Tradier supports it I believe, FXCM no).

I assume your quote above was from a FX broker since it mentions pips. 99% of FX brokerages are market makers -- they fill your trades within the company profiting from the spread. This means they can create lots of exotic order types. FXCM is a DMA (direct market access) which means they send your trades into the wider FX market to be filled.

For the brokerage these exotic orders can be risky since they are required to guarantee the order type behavior (the wider stock market or fx pools might not have those order types).

Hope that helps!
1

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.


Ah, okay got it. Placing a limit order above market price would satisfy the slippage mitigation, but the order stays active right? Meaning, any moment thereafter it could trigger. I would need the order to cancel if the order wasn't immediately filled. Do you suppose there is a sort of setTimeout possibility to check the order's status every 200ms or so after it was placed and if x amount of milliseconds have passed with no fill, it be canceled?
0

You could try! :) You could use the OrderTickets to bind to fill events, or use the Schedule API to set up events for Time+1sec from now.

I wouldn't recommend x-milliseconds though. You'll cancel your orders before they have a chance to get filled and might get into a weird portfolio state. Especially in backtesting where the fill events are calculated each time-loop.
0

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.


Update Backtest





0

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.


Loading...

This discussion is closed