Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order Handling when "Received message"

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

    Order Handling when "Received message"

    I'm starting to work on shorting stocks and I can't seem to find how to handle when I receive a message. It isn't an error, it's yellow on the log. When I go to short a stock, if there aren't shares available to short it, I'll receive the message "Order held while securities are located."

    I'd like to cancel all open orders for that strategy when a message like that comes in because if there are shares found later in the day, it could execute the trade at an undesirable price.

    Or an alternative would be to close any open orders if the price is more than x% away from the time of the order.

    Is there any way to implement either of those?

    #2
    Hello RaddiFX,

    If the warning is not producing a rejection when an order is submitted there would not be a way for your script to observe that. A strategy can only see order rejections with broker messages if RealtimeErrorHandling is disabled, at that point rejections can be observed from OnOrderUpdate.

    If the instrument being traded is just a low volume instrument there may not be anything that could be done to avoid that other than monitoring your strategy while it trades to ensure the market at that time allows for the trade to happen. You can also contact your broker to go over that warning to see if they can provide any further suggestions or alternate ways to trade that instrument.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    88 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    134 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    118 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    67 views
    0 likes
    Last Post PaulMohn  
    Working...
    X