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 Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
560 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
325 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
547 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
547 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment