Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to achieve OCO orders?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to achieve OCO orders?

    I have tried to create orders so that the stop and target orders are considered OCO but they are not behaving that way. Also when I look at the Orders tab of control panel, the OCO column is blank, so I must not understand it.

    To enter order I do this:
    Code:
    EnterLong(longPosSize, entrySignalName);
    In the OnExecutionUpdate callback, when entry order is filled, I do this to enter stop order:
    Code:
    stopOrder = ExitLongStopMarket(BARS_INDEX, LIVE_UNTIL_CANCELLED, (target1Size + target2Size), stopPrice, stopName, entrySignalName);
    And i do this for target order:
    Code:
    tgt1Order = ExitLongLimit(BARS_INDEX, LIVE_UNTIL_CANCELLED, target1Size, target1Price, TGT_1_NM, entrySignalName);
    I thought that by referring to the 'entrySignalName' as the last parameter in the calls, they would automatically become OCO. I have verified that 'entrySignalName' is the same value in all uses.

    What needs to change?

    Thanks,
    Gary

    #2
    Hello GaryAlbers,

    Thanks for your post.

    It would not be expected to populate an OCO ID number in the orders tab, and this is the same behavior as NT7.

    It would be expected that your profit or target would be canceled when the other is filled when using the signal names.

    If you are not seeing that behavior, please post your script or a sample script that shows the issue. If you would prefer not to post the script, please feel free to write into PlatformSupport[at]NinjaTrader[dot]Com, attach your source code file to the reply and mark the subject Attn: Paul and include a link to this thread.

    Edit- clarified OCO ID number "in the orders tab".

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    62 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    134 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    75 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    50 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X