Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

averageFillPrice and Close[0]

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

    averageFillPrice and Close[0]

    Hi
    Indeed, I have two questions with the same objective. In a strategy, when a signal is generated, an order is executed with a stoploss and a profit target. Using `onorderupdate`, we can retrieve `averageFillPrice`, the stoploss (`sl`), and the profit target (`tp`). However, my concern is not to execute the order but simply to retrieve the order execution price, i.e., `close[0]`.

    The dilemma arises when a signal is generated because `close[0]` differs from `averageFillPrice`. My main question is: how can I precisely retrieve this execution price (`averageFillPrice`) without placing the order?

    I have considered a solution, but I'm unsure of its feasibility. If we execute this strategy on an account (sim1) with order execution, would it be possible to retrieve this `averageFillPrice` value from another strategy on a different account (sim2 or live)?
    and If there are examples for this scenario, I would appreciate it if you could share them.

    I want to express my gratitude for the time you dedicate to helping us.​

    #2
    Hello aekzof,

    Thank you for your post.

    "My main question is: how can I precisely retrieve this execution price (`averageFillPrice`) without placing the order?"
    I do not understand what you are asking here. AverageFillPrice is a property of an Order object:


    A value is only available after an order has been filled (or partially filled in some cases with orders that have a quantity greater than 1 that have not completely filled yet). Otherwise, you could access values such as LimitPrice or StopPrice to understand what price an order is set to. Ultimately, when trading live order fills are dictated by the broker and the exchange and NinjaTrader would not know if an order will be executed or what price it would be executed at until the execution is complete.

    Please provide an example of what you are looking for. You mentioned executing the strategy on an account and then retrieving the value from another strategy on a different account, though I don't think I am following your idea here. Please explain what orders you are referring to from which strategies and what values you are looking to get, even if you provide fake values for the example it may help me to better understand and assist you.

    I look forward to your clarification.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    625 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    359 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    105 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    562 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    567 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X