Hi all,
Am wondering how to “post date” a submitted market order and cancel multiple orders when one order executes.
I am using a “fire it and forget it” logical method, so all exit orders are submitted immediately after the entry fill response.
Is there a way to submit a :"post dated" MarketOnClose order to the broker where it will sit on the books ,and won't actually execute, until a specified number of resolution bars (time) has passed?
This isn't built yet, but here is what I want to do…….
MarketOnOpen gets sent/filled
get response fill ticket and calculate target price, stop price,, and time stop date/time
submit OCO Limit Target Order, OCO Market Stop Order and OCO TimeStop Market Order, to exit, where each order will need to cancel the two other orders if hit.
Not sure how to set this up so the unexecuted orders cancel when one hits.
A Stop Limit entry order that cancels the time stop order and the time stop order is OCO to cancel the entry Stop Limit order ??
To calculate the date/time of the time stop, I use “MaxHold”, to indicate how many bars the position will hold, before it executes a MarketOnClose to exit the position if the target or stop don't trigger within the MaxHold number of bars.
I count bars, rather than track time, so I can easily opti for different circumstances in all resolutions.
This means the TimeStop market order is “post dated” to execute at a defined point in time (now + MaxHold bars)…….like it's sitting in que at the broker.
Any help appreciated.
Cheers!
~Cary
Varad Kabade
Hi Cary Cocke,
We recommend going through the following thread to create a stop market and limit orders for stop loss and take profit(OCO). To create an OCO MarkenOnClose order, we can use self.MarketOnCloseOrder
to place the order and store the order ticket, so we cancel this order when the above two are triggered.
Best,
Varad Kabade
Cary Cocke
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!