Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
CreateOrder(..) works but stop and limit get cancelled?
Collapse
X
-
Hello defa0009,
Thank you for your post.
You can tie them via OCO. I recommend taking a look at ProfitChaseStopTrailAddonExample and/or ProfitCaseStopTrailIndicatorExample, these scripts demonstrate how to tie your orders together via OCO.What's the trick to get all 3 orders to stick and tied to each other?
Things like FromEntrySignal is also only used with the Managed Approach to tie Enter and Exit orders together. There is no fromEntrySignal parameter when using CreateOrder(). We can specify a name for the order for your own tracking, but there isn't anything internal to these approaches to tie orders together (other than OCO) because you are working with the orders at a lower level where there is no order management layer like the Managed Approach.And how do you how close a specific market order? Using the entryOrder example above is this the way to do it?
Please let us know if you have any further questions.
-
Hello,
Yes, in OrderUpdate we check that the entry order has been created then create the PT and SL orders and link them via OCO.
I don't see in this code that you have specified an OCO ID. You need to link the entry, SL, and TP orders with the same OCO ID, otherwise the one-cancels-other logic won't trigger.
Market orders can't use OCO since they fill immediately. Only limit or stop market orders can be used with OCO.Last edited by NinjaTrader_Gaby; 09-04-2024, 10:10 AM.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
85 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
143 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
83 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
256 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|
||
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
334 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|

Comment