Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to get fill price of market order

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

    How to get fill price of market order

    Hi,
    How do I get this in code?
    Thanks ... Ed

    #2
    Hello Edstaffin,

    Thank you for your note.

    You can use the OnOrderUpdate(IOrder order) method to grab any order updates from the strategy and use that IOrder object to get the fill price.

    http://www.ninjatrader.com/support/h...rderupdate.htm

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

    Comment


      #3
      Hi, thanks, but I guess I wasn't specific enough. OnOrderUpdate gets called about a half dozen times with differing values in the IOrder. All I want is to get the fill price for a market order. I don't know how to filter OnOrderUpdate to get the value I want. Is there an example available that would help?
      Thanks ... Ed

      Comment


        #4
        Ed,

        Here is a sample of you will want to look for -

        Code:
        protected override void OnBarUpdate()
        {			
        	EnterLong("LongEntry");			
        }
        		
        protected override void OnOrderUpdate(IOrder o)
        {
        	if(o.OrderState == OrderState.Filled && o.Name == "LongEntry")
        		Print(o.AvgFillPrice);
        }
        Cal H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by SalmaTrader, 07-07-2026, 10:26 PM
        0 responses
        47 views
        0 likes
        Last Post SalmaTrader  
        Started by CarlTrading, 07-05-2026, 01:16 PM
        0 responses
        22 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 06-17-2026, 10:32 AM
        0 responses
        15 views
        0 likes
        Last Post CaptainJack  
        Started by kinfxhk, 06-17-2026, 04:15 AM
        0 responses
        21 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 06-17-2026, 04:06 AM
        0 responses
        23 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X