View Full Version : Canceling an ATM Order
laocoon
03-17-2010, 04:42 AM
Hello
I'm using an ATM strategy that sends a buy/sell order at the end of a closed bar to enter with a Stop Limit order if the next bar makes a tick higher than the high/lower than the low of the previous bar.
Now, if the bar DOES NOT make that higher or lower tick, I'd like to cancel the order at the end of the bar. I obviously can't use the BarsSinceEntry command since the order state is "accepted" but not "filled" if the entry condition isn't met.
Thanks for pointing me in the right direction.
Regards
NinjaTrader_Bertrand
03-17-2010, 05:15 AM
laocoon, are you referring to a NinjaScript strategy or ATM template triggered from a NinjaScript strategy to manage your exits?
You will need to work with either CancelOrder() or AtmStrategyCancelEntryOrder() for this task -
http://www.ninjatrader-support.com/HelpGuideV6/AsmStrategyActive.html
http://www.ninjatrader-support.com/HelpGuideV6/CancelOrder.html
Note also that if you're using a StopLimit entry from a NinjaScript strategy that this would expire if not filled with in the bar it was placed on, default NT behavior -
http://www.ninjatrader-support.com/HelpGuideV6/Overview36.html
laocoon
03-17-2010, 06:07 AM
Hello Bertrand
Thanks for your reply. I'm familiar with the different order placement/management commands, but what I'm not familiar with is how to count the number of candles since the order was placed (BarsSinceEntry obviously doesn't work since I only want to cancel an order if it hasn't been filled in the previous candle).
Thanks
NinjaTrader_Bertrand
03-17-2010, 06:16 AM
laocoon, please correct me if I'm wrong, but you only want this StopLimit entry order to be placed for the next bar following the entry condition? Then it would expire automatically if not filled (unless you set it to liveUntilCancelled) -
http://www.ninjatrader-support.com/HelpGuideV6/EnterLongStopLimt.html
laocoon
03-17-2010, 08:30 AM
Hi Bertrand,
Thanks for your reply, but I'm looking to do this with an ATM Strategy.create command, where LiveUntilCancelled does not exist.
Sorry for the confusion.
Thanks
NinjaTrader_Bertrand
03-17-2010, 08:52 AM
laocoon, thanks for clarifying - then you would need for example save the time the order was placed and call the AtmStrategyCancelEntryOrder() once you're close to completing the current bar...a custom timer event would do as well for this.
http://www.ninjatrader-support2.com/vb/showthread.php?t=5965