Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Scrip oco
Collapse
X
-
Scrip oco
Hello, I want you to send two orders, a BUYSTOP and SELLSTOP, given the conditions of my strategy, according to a level defined by my strategy, and that when one is filled, it cancels the other. And I looked for the information but everything is referred to the DOM. I want to program the script. Thank you!Tags: None
-
Hello Misel,
Thank you for your post.
The Managed approach contains Set methods such as SetProfitTarget and SetStopLoss that could be used to place One Cancels Other (OCO) orders. This means that two orders could be placed and are tied together by an OCO Id. When one order is filled, the other order is canceled.
Please see the attached SetMethodsSample example which demonstrates how to use SetProfitTarget and SetStopLoss to place a profit target and stop-loss when an entry order is filled.
Also, please see this help guide link about using the Managed approach - https://ninjatrader.com/support/help...d_approach.htm
The Unmanaged approach is able to use the OCO feature also and would need to be used for bracketed entry orders.
Please see the attached UnmanagedTemplate example which demonstrates how you could use the Unmanaged approach to accomplish this.
Also, please review this help guide link about using the Unmanaged approach - https://ninjatrader.com/support/help...d_approach.htm
Let us know if we may assist further<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
-
Thanks for the reply, I mean to put a buy order and a sell order each at a certain level. If you fill the sell order, you cancel the unfilled purchase order. If you fill the purchase order, you cancel the unfilled sell order. After filling the order, whether it is to buy or sell, the target and stop are designated there.
The problem I have is that it only places a buy or a sell order and not both at the same time.
Comment
-
Hello Misel,
Thank you for your note.
The UnmanagedTemplate example attached in the previous post demonstrates how you could submit buy and sell entry orders that are tied together using an OCO Id. The way this works is that the strategy submits the buy and sell entry orders and if the buy entry order is filled, the sell entry order is canceled and a profit target and stop-loss are placed for the buy entry order that was filled.
Please see the video in the link below which shows the UnmanagedTemplate example doing this.
World's leading screen capture + recorder from Snagit + Screencast by Techsmith. Capture, edit and share professional-quality content seamlessly.
Let us know if we may assist further.<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
80 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
46 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
29 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
32 views
0 likes
|
Last Post
|
||
|
Started by Mindset, 02-28-2026, 06:16 AM
|
0 responses
66 views
0 likes
|
Last Post
by Mindset
02-28-2026, 06:16 AM
|

Comment