In Playback, I have placed Short order for 10 quantity with signal name "$Short" and all 10 got filled. I placed stop loss order (sstop) and target order(starget) for the same. Stop loss order got filled for 10 quantity. I am expecting target order has to be cancelled for all 10 quantity. But What I observed is, 1 got filled on target and 9 got cancelled. This is not expected right ? What cases it would be like this. There one long position opened due to this. How to handle this ?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Stoploss and Target order filled quantity are not closed properly
Collapse
X
-
Stoploss and Target order filled quantity are not closed properly
Hi,
In Playback, I have placed Short order for 10 quantity with signal name "$Short" and all 10 got filled. I placed stop loss order (sstop) and target order(starget) for the same. Stop loss order got filled for 10 quantity. I am expecting target order has to be cancelled for all 10 quantity. But What I observed is, 1 got filled on target and 9 got cancelled. This is not expected right ? What cases it would be like this. There one long position opened due to this. How to handle this ?
Tags: None
-
Hello nandhumca,
Where you are expecting an order to be cancelled, this is because you are calling CancelOrder() and supplying the variable with the order assigned from OnOrderUpdate(), is this correct?
Are you checking the order is not null, and the OrderState is OrderState.Working or OrderState.Accepted before attempting to cancel the order with CancelOrder()?
If you are not, see the ProfitChaseStopTrailExitOrdersExample_NT8 or ProfitChaseStopTrailUnmanagedExample_NT8 depending on what type of strategy you have created.
Chelsea B.NinjaTrader Customer Service
-
I have a code to cancel my entry order if it is working or part_filled state and not null. But in the sample I gave, the entry order got filled. When Stop order for that entry is fully filled, the associated target order will be cancelled automatically. But here that didn't happed .
Comment
-
Hello nandhumca,
An order that is part filled is extremely hard to cancel because its filling and will likely keep filling until filled.
The order would have to be part filling extremely slowly to be able to get a cancel order with the correct quantity without the cancellation being rejected.
I recommend you only try and call CancelOrder() on working orders and not filled or part filled orders.Chelsea B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by ttrader23, Today, 04:48 PM
|
0 responses
2 views
0 likes
|
Last Post
![]()
by ttrader23
Today, 04:48 PM
|
||
Started by wisdomspoon, Today, 03:50 PM
|
3 responses
14 views
0 likes
|
Last Post
![]()
by rockmanx00
Today, 04:33 PM
|
||
Started by Mountain_cast, 02-10-2025, 11:14 PM
|
2 responses
19 views
0 likes
|
Last Post
![]() |
||
Started by Robotman, Today, 01:06 PM
|
2 responses
37 views
0 likes
|
Last Post
![]()
by Robotman
Today, 02:05 PM
|
||
Started by PH_GMT, Today, 12:40 PM
|
4 responses
19 views
0 likes
|
Last Post
![]()
by PH_GMT
Today, 02:41 PM
|
Comment