Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Entry price of and Order submitted by a Strategy

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

    Entry price of and Order submitted by a Strategy

    Hi,

    I would like to get to the price at which an Order, submitted via Strategy, was filled. Can you provide a link to the help ? Thank you.

    Anthony

    #2
    Hello Anthony_0709,

    Thank you for your post.

    Are you wanting to print the price of an order using a script made by the Strategy Builder or a script in the NinjaScript Editor?

    You could simply print the price of a position by checking if Position.MarketPosition != MarketPosition.Flat followed by printing the price using Position.AveragePrice. Please see the attached example 'GetMarketPosition' which demonstrates how this could be accomplished.

    Or, you could print the price of an account position by printing PositionAccount.AveragePrice.

    You could get the price of an account position when using AddOn Framework by looping through the positions in account.Position and print position.AveragePrice to see the price of the position. Please see the attached example 'PrintAccountPositions' which demonstrates how this could be done.

    Additionally, here are some help guide links below for more information,

    Position - https://ninjatrader.com/support/help...8/position.htm

    PositionAccount - https://ninjatrader.com/support/help...ionaccount.htm

    AddOn Framework Account Positon - https://ninjatrader.com/support/help...ns_account.htm

    Let us know if we may assist further.
    Attached Files
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Hi,

      Good day !

      When does Position.AveragePrice get updated (populated) ? Because I'm getting zero (0).

      Calculate=OnEachTick, IsFirstTickOfBar=true, other conditions are met: -> EnterLong(), (I can see on the chart that the order was filled), myFillPrice = Position.AveragePrice, return;

      All of the above is done during the same cycle/instance. On the following tick "myFillPrice" reports zero (0). Is Position.AveragePrice available right after EnterLong() and during the same cycle/instance or upon the following tick(s) ? Do I have to use OnOrderUpdate() ?

      Thank you.

      Anthony

      Comment


        #4
        Hello Anthony_0709,

        Thank you for your note.

        Position.AveragePrice would get updated in OnBarUpdate on the next bar after an order is submitted. This means that you would need to place your print for Position.AveragePrice after checking that the order has been submitted. This ensures that the position was submitted and Position.AveragePrice has been updated.

        For example, in the GetMarketPosition example attached in post 2 we check if Position.MarketPosition == MarketPosition.Flat and EnterLong. Then, we check if the position is filled by checking if Position.MarketPosition == MarketPosition.Long followed by adding our print to get the Position.AveragePrice of the filled position.

        Please let us know if we may assist further.
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        69 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        42 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        24 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        27 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        54 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X