Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order can't be submitted. "The OCO ID cannot be reused"

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

    Order can't be submitted. "The OCO ID cannot be reused"

    Hello I have the same issue, I pressed Control+z "OCO" ico get disabled but I have the same message error.
    I also have another message error that says that order buy stop or buy stop limit cannot be put below the market touch order : BuyToCover 1 StopMarket @ 150.

    It's from a strategy ninjascript with an ATM.
    This is the code :

    if(Times[0][0].TimeOfDay > OrEnd.TimeOfDay && atmStrategyId.Length == 0 && CrossAbove(Close, ORHigh, 1))
    {
    isAtmStrategyCreated = false;
    atmStrategyId = GetAtmStrategyUniqueId();
    OrderIdB = GetAtmStrategyUniqueId();

    double buyPrice = 0.0;
    buyPrice = GetCurrentAsk() + 4 * TickSize;

    AtmStrategyCreate(OrderAction.Buy, OrderType.Market, buyPrice, 0, TimeInForce.Day, OrderIdB, "AtmOpStrategy", atmStrategyId, (atmCallbackErrorCode, atmCallBackId) =>
    {
    if(atmCallbackErrorCode == ErrorCode.NoError && atmCallBackId == atmStrategyId)
    {
    isAtmStrategyCreated = true;
    }
    });
    }

    if(Times[0][0].TimeOfDay > OrEnd.TimeOfDay && atmStrategyId.Length == 0 && CrossBelow(Close, ORLow, 1))
    {
    isAtmStrategyCreated = false;
    atmStrategyId = GetAtmStrategyUniqueId();
    OrderIdS = GetAtmStrategyUniqueId();

    double sellPrice = 0.0;
    sellPrice = GetCurrentBid() - 4 * TickSize;

    AtmStrategyCreate(OrderAction.Sell, OrderType.Market, sellPrice, 0, TimeInForce.Day, OrderIdS, "AtmOpStrategy", atmStrategyId, (atmCallbackErrorCode, atmCallBackId) =>
    {
    if(atmCallbackErrorCode == ErrorCode.NoError && atmCallBackId == atmStrategyId)
    {
    isAtmStrategyCreated = true;
    }
    });
    }

    if(!isAtmStrategyCreated)
    {
    return;
    }

    if(OrderIdB.Length > 0)
    {
    string[] status = GetAtmStrategyEntryOrderStatus(OrderIdB);

    if(status.GetLength(0) > 0)
    {
    if(status[2] == "Filled" || status[2] == "Cancelled" || status[2] == "Rejected")
    {
    OrderIdB = string.Empty;
    }
    }
    }
    else if(OrderIdS.Length > 0)
    {
    string[] status = GetAtmStrategyEntryOrderStatus(OrderIdS);

    if(status.GetLength(0) > 0)
    {
    if(status[2] == "Filled" || status[2] == "Cancelled" || status[2] == "Rejected")
    {
    OrderIdB = string.Empty;
    }
    }
    }
    else if(atmStrategyId.Length > 0 && GetAtmStrategyMarketPosition(atmStrategyId) == Cbi.MarketPosition.Flat)
    {
    atmStrategyId = string.Empty;
    }
    }

    Do you have any idea to resolve this issue.
    Thank you !​

    #2
    Hello Sacrifist13,

    The problem is not an OCO issue, its that the order was placed on the wrong side of the market and was rejected. You need to adjust your targets to avoid that from happening.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by kinfxhk, 07-13-2026, 10:18 AM
    0 responses
    58 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 09:50 AM
    0 responses
    41 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 07:21 AM
    0 responses
    46 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-11-2026, 02:11 AM
    0 responses
    37 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    156 views
    0 likes
    Last Post SalmaTrader  
    Working...
    X