Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trade Entry Price

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

    Trade Entry Price

    Hi ... need to access the entry price of an executed trade from within my code. what function do I use to achieve this? thank you!

    #2
    Hello,

    If this is for a particular order, you can track this information by accessing the IOrder object:

    MatthewNinjaTrader Product Management

    Comment


      #3
      thank you Matthew ... can you give me an example on how I access the filled price?

      Comment


        #4
        You need to first create an IOrder object as per our help guide. Once you've done that, you can get this information using order.AvgFillPrice

        Code:
        			protected override void OnOrderUpdate(IOrder order)
        			{
          			  if (entryOrder != null && entryOrder == order)
          			  {
         
             			    Print(order.AvgFillPrice);
        			}
        This is the Filled Price for the position.

        If you're instead looking for the execution price of a single order, you can use OnExecution to get the IExecution property .Price



        Code:
        			protected override void OnExecution(IExecution execution)
        			{
        				if (entryOrder != null && entryOrder == execution.Order)
        					Print("Execution Price: " + execution.Price);
        			}
        MatthewNinjaTrader Product Management

        Comment


          #5
          Entry Price of the order

          Have you ever find this answer? because I look for entry price function of the order all over but could not find the answer
          Last edited by craigtran; 06-18-2016, 12:49 PM. Reason: update

          Comment


            #6
            Hello craigtran,

            Thank you for writing in and welcome to the NinjaTrader Support Forum!

            NinjaTrader_Matthew has provided a sample of how to obtain the entry price.

            Can you please clarify what you are needing assistance with?
            Zachary G.NinjaTrader Customer Service

            Comment


              #7
              Thanks for replying,

              I am writing a strategy and does not want close the position if the gain did not reach a minimum number.

              So to do that, I need the entry price so I can calculate the gain at that moment.

              Thanks

              Craig

              Comment


                #8
                Hello craigtran,

                Position.AvgPrice will provide the average entry price of your position: https://ninjatrader.com/support/help.../?avgprice.htm
                Zachary G.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                566 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                330 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                101 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                547 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                548 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X