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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    90 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    137 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    120 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    71 views
    0 likes
    Last Post PaulMohn  
    Working...
    X