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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    81 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    64 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    66 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    54 views
    0 likes
    Last Post CarlTrading  
    Working...
    X