Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order can't be submitted - the OCO ID xxxx cannot be reused + Buy stop error

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

    Order can't be submitted - the OCO ID xxxx cannot be reused + Buy stop error

    Hello forum,

    I have 2 errors combined.
    The first being Order can't be submitted - the OCO ID xxxx cannot be reused and the other is Buy stop or buys stop limit order cant be placed below market.

    My setup is the following
    Calculate.OnBarClose
    OnBarUpdate() - used to calculate some conditions
    OnMarketData() - used to calculate some other conditions and to enter an order using EnterShort.

    I am also using checks to entry an order only once every barclose so there shouldn't be duplicate orders

    I do not understand if the errors are causing one another or not. I had Buy stop or buys stop limit order solved in the past by updating to the latest NinjaTrader8 version but the OCO one is new.

    Attached you can find a screenshot of the errors and a snippet simulating the logic flow

    Thank you!
    Attached Files

    #2
    Hello Theghios, thanks for your post.

    It looks like EnterShort("Shorto"); is being called a second time, causing this OCO error. You can confirm this by adding a Print method right before the entry order:

    Print("Entering Short");
    EnterShort("Shorto");

    On each bar, the hasShorted variable is set back to false, so it's definitely possible the strategy will go short, then do it again on the next bar if the entry conditinos are true. You should check the Position object to ensure you are flat before entering:

    if(Position.MarketPosition == MarketPosition.Flat)
    {
    EnterShort("Shorto");
    }

    For the error: Buy stop or buys stop limit order cant be placed below market.

    Resolving the first problem might fix this. It means the stoploss order was placed at an illegal price level which should not happen since your parameter type for the stop is in Tick mode, so it will place the stop and target X amount of ticks away from the entry order. When the first issue is resolved please let me know if you are still getting this error.

    Please let me know if I can assist any further.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    50 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    126 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    69 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    42 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X