Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ExecutionPrice - OrderPrice

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

    ExecutionPrice - OrderPrice

    Hello,

    from the NT-samples I know how I can get the Execution Price (in OnExecution with "exprice=execution.Order.AverageFillPrice) but I can´t find how I can get the "Order Price" before it is executed. (not in the sampleOnOrderUpdate nor in another sample). I need the value of a working short or long entrylimit.

    Thank you!
    Tony

    #2
    Hello tonynt,

    Thank you for your post.

    The limit price of an order can be retrieved using Order.LimitPrice:

    Code:
    private Order entryOrder = null;
    
    protected override void OnBarUpdate()
    {
      if (entryOrder == null && Close[0] > Open[0])
          EnterLong("myEntryOrder");
    }
    
    protected override void OnOrderUpdate(Order order, double limitPrice, double stopPrice, int quantity, int filled, double averageFillPrice, OrderState orderState, DateTime time, ErrorCode error, string nativeError)
    {
      // Assign entryOrder in OnOrderUpdate() to ensure the assignment occurs when expected.
      // This is more reliable than assigning Order objects in OnBarUpdate, as the assignment is not guaranteed to be complete if it is referenced immediately        after submitting
      if (order.Name == "myEntryOrder")
          entryOrder = order;
    
      if (entryOrder != null && entryOrder == order)
      {
          Print(order.LimitPrice);
          if (order.OrderState == OrderState.Filled)
              entryOrder = null;
      }
    }
    If you assign the order to a variable, as we've done in the example above, you can then access that during OnBarUpdate using the variable - just make sure to check that it's not null before printing:

    Code:
            protected override void OnBarUpdate()
            {
                // other code omitted
    
                if(entryOrder != null)
                {
                    Print(entryOrder.LimitPrice);
                }
            }
    Here's a link to our help guide on the Order object:



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

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    93 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    138 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
    123 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    73 views
    0 likes
    Last Post PaulMohn  
    Working...
    X