Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

No Status returned when some orders are cancelled

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

    #16
    i have just come up with a solution. straight after order is placed i set a variable called Order_Status to a string called "initialized". then at the top of my EL or EFS code I put in a line of code that says: if OrderStatus() == "pending submit" or OrderStatus()=="accepted" or OrderStatus()=="working" or OrderStatus()=="rejected" or OrderStatus()=="part filled" or OrderStatus()=="filled" then Order_Status=OrderStatus();

    then the next line of code says: if Order_State == "" or Order_State=="filled" or Order_State=="part filled" or Order_State=="rejected" then
    {
    if NTmarketPosition=0 and buy condition 1 = true then
    {
    Buy 1 contract at market;
    Order_State = "initialized";
    }
    }

    this gets around the problem that the NT function OrderStatus() does not return a string called "initialized" straight after an order is generated by e-signal or tradestation strategy code. once we know that an order has been filled, partfilled or rejected (or that no order exists ie empty string for Order_Status) we can then safely check NTmarketPosition to see what our position is at broker.

    hope this can help Moscu in some way, or any one else.

    good trading!

    Rocket ^

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    29 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    117 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    69 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    227 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    309 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X