Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order Entry Price

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

    Order Entry Price

    I've tried to get this numerous ways, but can't figure out quite how to get the entry price of an order.

    What is the best way to get the entry price of an order?

    Thanks.

    #2
    Hello ATMtrader0001,

    Thanks for your post.

    You could access Position.AveragePrice in OnBarUpdate() as the actual entry price, when the MarketPosition is not flat.

    See this help guide page for more information: https://ninjatrader.com/support/help...erageprice.htm

    Alternately, you can check Order.AverageFillPrice in OnExecutionUpdate()

    See the help guide documentation below for more information.
    OnExecutionUpdate(): https://ninjatrader.com/support/help...tionupdate.htm
    Order: https://ninjatrader.com/support/help...nt8/?order.htm

    Let me know if I 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


      #3
      I tried that and I get the result as 0.

      The code is:
      EnterLong(iOrderSize, szOrderName);
      dOrderPrice = Position.AveragePrice;

      And it returns a 0. Do I need to wait until the next bar/tick for it to update?

      Comment


        #4
        Hello ATMtrader0001,

        Thanks for your note.

        Please see the attached example script which is a modified version of the SampleMACrossover strategy demonstrating how to use Position.AveragePrice.

        Note that we check if Position.MarketPosition == MarketPosition.Long and Position.MarketPosition == MarketPosition.Short to ensure we are in a Long or Short position before printing Position.AveragePrice. If you are in a Flat position, Position.AveragePrice will return 0.

        See this help guide page for more information about Position.MarketPosition: https://ninjatrader.com/support/help...etposition.htm

        Let me know if I 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

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        66 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        141 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        76 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        47 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        51 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X