Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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".
    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by rjbtrade1, 11-30-2023, 04:38 PM
    2 responses
    77 views
    0 likes
    Last Post DavidHP
    by DavidHP
     
    Started by Stanfillirenfro, Today, 07:23 AM
    3 responses
    13 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by FitSpressoHonest, Today, 09:14 AM
    0 responses
    4 views
    0 likes
    Last Post FitSpressoHonest  
    Started by Davide999, 05-18-2023, 03:55 AM
    4 responses
    557 views
    1 like
    Last Post kcwasher  
    Started by rexsole, Today, 08:39 AM
    2 responses
    8 views
    0 likes
    Last Post NinjaTrader_Erick  
    Working...
    X