Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to Get the Filled Price of a Position

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

    How to Get the Filled Price of a Position

    Hi Folks,

    How can I retrieve the filled price of a specific position in a multiple positions strategy?

    For instance:

    EnterLong("Entry 1");
    EnterLong("Entry 2");
    EnterLong("Entry 3");​

    How can I get the filled price of these 3 positions individually? Please don't pay attention as to why would I open 3 positions at the same time, this is just for the purpose of the example.

    Thank you very much

    #2
    Hello GoodBro,

    Thanks for your post.

    You could track the order objects in OnExecutionUpdate() to get the price of the order.

    To do so, you would track the order objects, check if the order object is not null, check that the oder object is equal to execution.Order, and check if the execution.Order.OrderState is equal to OrderState.Filled followed by printing the price.

    See the help guide documentation and reference sample below for more information.

    OnExecutionUpdate(): https://ninjatrader.com/support/help...tionupdate.htm
    Reference Sample: https://ninjatrader.com/support/help...and_onexec.htm
    <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
      Originally posted by GoodBro View Post
      How can I retrieve the filled price of a specific position in a multiple positions strategy?

      For instance:

      EnterLong("Entry 1");
      EnterLong("Entry 2");
      EnterLong("Entry 3");

      How can I get the filled price of these 3 positions individually? Please don't pay attention as to why would I open 3 positions at the same time, this is just for the purpose of the example.
      In the name of education, let's address the words used
      in your description. I'll try to be gentle, but direct.

      Those 3 buy orders do not represent 3 different positions.

      If you think that way, you're in a different world.

      I'd bet my left that NinjaTrader will not show these 3 orders
      as 3 positions in the Positions tab. ​The NinjaTrader Desktop
      software sees all Buy orders dealing with one instrument as
      a single Long position.

      There is nothing wrong with what you're doing. Far from it.

      What I'm addressing is your use of the 'multiple positions'
      characterization -- this language is imprecise, and arguably,
      it is incorrect. Thinking in those terms can work against you.

      -=o=-

      The better description is 'scaling-in'. Scaling basically means
      adding or removing units from your original open position.​

      You've simply added to the existing position with your two
      extra Buy orders via the 2nd and 3rd calls to EnterLong.

      Well, that's the definition of 'scaling-in'.

      This single position has an average fill price, which takes
      into account your scaling-in technique using 3 separate
      fill prices from 3 separate entry orders.

      -=o=-

      That being said, you can still find the fill price for each
      entry order separately using OnExecutionUpdate, or
      even using OnOrderUpdate.

      Chelsea gave some good info with links to get you
      started.

      Just my 2˘.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      110 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      59 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      37 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      41 views
      0 likes
      Last Post TheRealMorford  
      Started by Mindset, 02-28-2026, 06:16 AM
      0 responses
      78 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X