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

Order '' can't be submitted; The OCO ID '' cannot be reused. Please use a new OCO ID.

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

    Order '' can't be submitted; The OCO ID '' cannot be reused. Please use a new OCO ID.

    I'm getting the

    Order '9f75883fde9b477689b3b11005of1883' can't be submitted; The OCO ID '9f75883fde9b477689b3b11005of1883' cannot be reused. Please use a new OCO ID.

    I'm getting the above error in my strategy and once this error occurs the strategy stops working and this error message is in the log. It works fine for some time but then out of nowhere it throws that error and strategy just dies... What can I do to prevent this?

    My Code is fairly simple:

    if (......))
    {
    Print("+_+_+_+ ... :: " + DateTime.Now );

    currentPtPrice = Close[0] + ProfitTargetDistance * TickSize;
    currentSlPrice = mySAR[0] - 1;

    if (UseProfitTarget)
    {
    SetProfitTarget(CalculationMode.Price, currentPtPrice);
    Print("Setting Long ProfitTarget at: --> " + currentPtPrice);
    }

    if (UseStopLoss)
    {
    SetStopLoss(CalculationMode.Price, currentSlPrice);
    Print("Setting Long StopLoss at: --> " + currentSlPrice);
    }
    EnterLong();
    .
    .
    .
    .
    .

    if (BarsInProgress == 1 && Position.MarketPosition == MarketPosition.Long)
    {

    if (....)
    {
    currentPtPrice = Close[0] + ProfitTargetDistance * TickSize;
    SetProfitTarget(CalculationMode.Price, currentPtPrice);
    Print("Adjusting Profit Target for Long to: --> " + currentPtPrice);

    SetStopLoss(CalculationMode.Price, mySAR[0]);
    Draw.Diamond(this, "LongStop", true, 0, mySAR[0], Brushes.Lime);
    Print("Adjusting Stop Loss for Long to: --> " + currentSlPrice);

    }else if (.....)
    ExitLong();

    Print("+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=");


    }

    #2
    Hello priceisking,
    Thank you for your post.

    This is due to the re-use of an OCO ID that was used for a prior order that was submitted. The solution is to use unique OCO IDs.

    I can take a closer look into this for you if you would like to send me your log and trace files.
    You can do this by going to the Control Center-> Help-> Mail to Platform Support. Ensuring 'Log and Trace Files' is checked will include these files. This is checked by default.

    Please list 'ATTN: Josh' in the subject line and reference this thread in the body the email.
    Josh G.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by wzgy0920, 04-20-2024, 06:09 PM
    2 responses
    26 views
    0 likes
    Last Post wzgy0920  
    Started by wzgy0920, 02-22-2024, 01:11 AM
    5 responses
    32 views
    0 likes
    Last Post wzgy0920  
    Started by wzgy0920, Yesterday, 09:53 PM
    2 responses
    49 views
    0 likes
    Last Post wzgy0920  
    Started by Kensonprib, 04-28-2021, 10:11 AM
    5 responses
    192 views
    0 likes
    Last Post Hasadafa  
    Started by GussJ, 03-04-2020, 03:11 PM
    11 responses
    3,234 views
    0 likes
    Last Post xiinteractive  
    Working...
    X