Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

GetAtmStrategyEntryOrderStatus() - clarification needed about the order state

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

    GetAtmStrategyEntryOrderStatus() - clarification needed about the order state

    Hi Support or whoever can answer my question,

    The method GetAtmStrategyEntryOrderStatus() returns a string[] array holding three elements that represent average fill price, filled amount and order state.

    Is it possible to enumerate all of the strings the 'order state' can contain? I have not been able to find this information in the doc.


    #2
    Hello trendisyourfriend,

    Thank you for your post.

    You could create an enum to hold all the order state options, yes:



    However, it's probably simpler to simply check order states by strings.

    A class that emulates enum behaviour but using string instead of int can be created as follows...

    Code:
    public class MyOrderState
    {
    private string _stateKeyWord;
    
    private MyOrderState(string stateKeyWord)
    {
    _stateKeyWord = stateKeyWord;
    }
    
    public override string ToString()
    {
    return _stateKeyWord;
    }
    
    public static MyOrderState Initialized = new MyOrderState("Initialized");
    public static MyOrderState Submitted = new MyOrderState("Submitted");
    public static MyOrderState Accepted = new MyOrderState("Accepted");
    public static MyOrderState Working= new MyOrderState("Working");
    // further order states would need to be added
    
    }
    .
    You could then use this to compare to the order state:

    Code:
    protected override void OnBarUpdate()
    {
    string[] entryOrder = GetAtmStrategyEntryOrderStatus("orde rId");
    
    // Check length to ensure that returned array holds order information
    if (entryOrder.Length > 0)
    {
    Print("Average fill price is " + entryOrder[0].ToString());
    Print("Filled amount is " + entryOrder[1].ToString());
    Print("Current state is " + entryOrder[2].ToString());
    
    if (entryOrder[2].ToString() == MyOrderState.Initialized)
    {
    // do something
    }
    }
    }
    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Kate View Post
      Hello trendisyourfriend,

      Thank you for your post.

      You could create an enum to hold all the order state options...

      Please let us know if we may be of further assistance to you.
      Thanks Kate,

      I think i have not been clear enough. You have identified these potential states:
      Initialized, Submitted, Accepted, Working

      But what i meant in my first post was how many potential states an order can go through?
      I would like to know all their name.

      Thanks

      Comment


        #4
        Hello trendisyourfriend,

        Thank you for your reply.

        The names of each order state may be found at the link in my previous reply:

        Please let us know if we may be of further assistance to you.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Kate View Post
          Hello trendisyourfriend,

          Thank you for your reply.

          The names of each order state may be found at the link in my previous reply:



          Please let us know if we may be of further assistance to you.
          Gotcha. My thanks and appreciation.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by geotrades1, Today, 10:02 AM
          1 response
          4 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by ender_wiggum, Today, 09:50 AM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by rajendrasubedi2023, Today, 09:50 AM
          1 response
          11 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by bmartz, Today, 09:30 AM
          1 response
          9 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by geddyisodin, Today, 05:20 AM
          3 responses
          26 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Working...
          X