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

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.
    Emily C.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Taddypole, 04-26-2024, 02:47 PM
    2 responses
    12 views
    0 likes
    Last Post Taddypole  
    Started by futtrader, 04-21-2024, 01:50 AM
    6 responses
    58 views
    0 likes
    Last Post futtrader  
    Started by sgordet, Today, 11:48 AM
    0 responses
    4 views
    0 likes
    Last Post sgordet
    by sgordet
     
    Started by Trader146, Today, 11:41 AM
    0 responses
    5 views
    0 likes
    Last Post Trader146  
    Started by jpapa, 04-23-2024, 07:22 AM
    2 responses
    22 views
    0 likes
    Last Post rene69851  
    Working...
    X