Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Identification of Execution Details

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

    Identification of Execution Details

    My strategy needs to know the price, quantity and the kind of order that was executed. I understand that "execution.price" tells me the executed price and "execution.Quantity" give me the number of contracts executed, but how can I tell if the execution was for a "long entry" or a "short entry"? Perhaps the "execution.Quantity" does this by the sign of the quantity (1 = long, -1 = short). Can you straighten me out on this please?

    Thank you.

    #2
    Hi Hcoffin,

    Thank you for your post.

    You can use Print(execution.Order.OrderAction) to print out the type of order that was placed, such as a Buy, Sell, Sell Short, or Buy to Cover.

    Below are links on the IOrder and IExecution -
    http://www.ninjatrader.com/support/h...tml?iorder.htm
    http://www.ninjatrader.com/support/h...iexecution.htm

    Let me know if I can be of further assistance.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Clarification Please

      Thank you for the quick response.

      Please tell me if I am correct on the following statements:

      1. OrderAction.Buy is a Long Entry Order (EnterLong)
      2. OrderAction.BuyToCover is a Long Exit Order (ExitLong)
      3. OrderAction.Sell is a Short Exit Order (ExitShort)
      4. OrderAction.SellShort is a Short Entry Order (EnterShort)

      Thank you in advance for your help.

      Comment


        #4
        Additional Question

        I have attempted to create code to do what my previous question was asking about, I got the following error messages when compiling:

        I set up a user-variable: private int OrderAction = 0;

        Within the OnExecution() method, I entered the following:

        if(execution.Order.OrderAction == OrderAction.Buy)
        {
        OrderAction = 1;
        }

        When compiling, the following error message came up:

        'int' does not contain a definition for 'Buy' and no extension method 'Buy' accepting a first argument of type 'int' could be found (are you missing a using directive or an assembly reference?)

        Can you see what is wrong with my code?

        Thanks again,

        Comment


          #5
          Originally posted by hcoffin View Post
          I have attempted to create code to do what my previous question was asking about, I got the following error messages when compiling:

          I set up a user-variable: private int OrderAction = 0;

          Within the OnExecution() method, I entered the following:

          if(execution.Order.OrderAction == OrderAction.Buy)
          {
          OrderAction = 1;
          }

          When compiling, the following error message came up:

          'int' does not contain a definition for 'Buy' and no extension method 'Buy' accepting a first argument of type 'int' could be found (are you missing a using directive or an assembly reference?)

          Can you see what is wrong with my code?

          Thanks again,
          Rename your variable: "OrderAction" is a reserved word.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          637 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          366 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          107 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          569 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          572 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X