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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    67 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    36 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    61 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    62 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    53 views
    0 likes
    Last Post CarlTrading  
    Working...
    X