Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Cancel Order on ATM Strategy
Collapse
X
-
Thanks Bertran, I would like to ask if what is the best thing that i would do if I have called an Atm Strategy template when my specified condition reached and then suddenly in the next 2 bars I need to cancel the order with limit because it crosses to my exit condition. I am confuse what I am going to do, I will cancel the Atm strategy order and then use exit method to close entirely the market position?. When using AtmStrategyCancelEntryOrder(OrderId) method does it imply that the market position is closed? Or do I need to add Exit Method?
-
Closing the ATM programmatically then I will use AtmStrategyClose("idValue"); after I cancelled the order? idValue parameter would be the atmstrategyId?
Comment
-
Thanks for your reply Bertrand. I am so confused with this problem will you please help me.
I have a strategy that will call an ATM strategy and I based it from the SampleAtmStrategy in NT then I wonder if why does the example execute an orderId=string.empty when the limit is filled? If the orderID is now empty does it mean that the entire order is already done because the it is already filled on that bar? How about the profit targets, stop loss and trail stop of my atm strategy are now useless because the OrderId is now empty? Or they will continue to process the profit targets, stop loss, and trail stop even if the OrderId is empty? I am now very confuse please help.
Comment
-
Is this code correct in checking order status if it is filled two bars after the order?
if (orderBarL >=2 && statusL[2]!="Filled")
{
CancelATMOrder();
CloseATM();
}
Thanks.
Comment
-
Hello Luxurios,
The reason the string is emptied is so that it can be used again for the next order placed. If it's filled, cancelled, rejected, then this will reset the string value.
Stops and targets can still continue to function but are not managed by NinjaScript. Once your ATM entry order has been filled, you're essentially passing the management of your exits to the ATM strategy specified.
For your Next Post:
Yes, it depends on how you have defined OrderBarL but that concept should work.Ryan M.NinjaTrader Customer Service
Comment
-
Okay, thanks for that RyanM now I understand why. Thanks a lot.
How abut this code RyanM:
atmStrategyIdL = GetAtmStrategyUniqueId();
orderIdL = GetAtmStrategyUniqueId();
orderBarL=CurrentBar;
AtmStrategyCreate(Cbi.OrderAction.Buy, OrderType.Limit, Low[0], 0, TimeInForce.Day, orderIdL, ATMstrategyTemplate, atmStrategyIdL);
if (CurrentBar >= orderBarL + 2 )
{
if (statusL[2]=="Working" || statusL[2]!="Filled")
CancelATMOrder();
}
I will cancel the order if two bars lapse from the order bar and then the order has not been filled.Last edited by luxurious_04; 09-07-2010, 07:52 PM.
Comment
-
Once the order is cancelled, the orderId is now reset then does it mean that the atmstrategyId is also in reset mode? So that if there is another entry signal then the strategy could get that signal..Last edited by luxurious_04; 09-07-2010, 08:07 PM.
Comment
-
Thanks a lot Bertran, your a great man.
When my order gets filled and then in the next bar I will exit because it reaches my exit condition. I will close the ATM programmatically and then reset the atmstrategyId and wait for the next entry signal. Does my thoughts for this is correct?
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by strategist007, Today, 07:51 PM
|
0 responses
2 views
0 likes
|
Last Post Today, 07:51 PM | ||
Started by StockTrader88, 03-06-2021, 08:58 AM
|
44 responses
3,968 views
3 likes
|
Last Post
by jhudas88
Today, 06:59 PM
|
||
Started by rbeckmann05, Today, 06:48 PM
|
0 responses
4 views
0 likes
|
Last Post
by rbeckmann05
Today, 06:48 PM
|
||
Started by rhyminkevin, Today, 04:58 PM
|
4 responses
58 views
0 likes
|
Last Post
by dp8282
Today, 06:13 PM
|
||
Started by iceman2018, Today, 05:07 PM
|
0 responses
6 views
0 likes
|
Last Post
by iceman2018
Today, 05:07 PM
|
Comment