Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

1. Strategy terminated due to OCO, order rejected. 2.Entry price higher/lower

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

    1. Strategy terminated due to OCO, order rejected. 2.Entry price higher/lower

    Hello,

    I am using EnterLong and EnterShort with Profit Targets and Stop Losses, so managed approach.

    However, I'm getting these errors. What could be the cause?

    Many Thanks, Caesar.

    Click image for larger version

Name:	1.jpg
Views:	123
Size:	22.6 KB
ID:	1269571

    Click image for larger version

Name:	2.jpg
Views:	99
Size:	24.8 KB
ID:	1269572

    Click image for larger version

Name:	3.jpg
Views:	100
Size:	18.1 KB
ID:	1269573

    #2
    Hello Caesar,

    Thank you for your post.

    Based on your screenshots, it seems that the stop loss order from SetStopLoss() was rejected because the order place was on the wrong side of the market:
    "But stop or buy stop limit orders can't be placed below the market."

    Then, since the stop loss was rejected that causes the OCO ID that pairs it with the profit target to become invalid. This is why you got the following message when the strategy attempted to submit the profit target order from SetProfitTarget():
    "Order can't be submitted: The OCO ID '' cannot be reused. Please use a new OCO ID."

    Finally, due to the rejected orders, the strategy's RealtimeErrorHandling procedure kicked in where it follows StopCancelClose. This means it will stop the strategy, cancel any remaining working orders, and then close any open position managed by the strategy. For more info:


    You will need to review the price being used for your stop loss and profit target orders to ensure they are being submitted to the correct side of the market. Here are some questions to consider to identify what might have happened: Where are you calling SetStopLoss() and SetProfitTarget() in your code? What calculation mode is being used? If the calculation mode is ticks and the offset of ticks is small or if the mode is price and the price is very close to the entry price, slippage could cause the price to move to the other side of where the order is attempting to be placed. You may need to consider using wider stops. If these methods are being called dynamically in OnBarUpdate(), are you calling the methods again when the position is flat to reset the price for the stop loss/profit target? If not, the last value for price will be used and it might be at an unexpected value resulting in this kind of error.

    For more info on SetStopLoss() and SetProfitTarget():



    Please let us know if we may be of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    20 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    119 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    63 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    41 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    45 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X