Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Where can I find additional samples reference for OnPositionUpdate() ?

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

    Where can I find additional samples reference for OnPositionUpdate() ?

    I can't find anything else that shows actually how is implemented : averageFillPrice, quantity...etc. I've tried different variations but fail on compilation.

    Thanks

    #2
    Hello pstrusi,

    I wasn't able to locate an example using these values from OnPositionUpdate(), so I have created one that prints these values and attached.
    OnPositionUpdateTest_NT8.zip

    I can also provide an example that uses the SystemPerformance collection when the position updates.
    Hello, I've updated the DailyLossLimit and DailyLosLimitMultiTrade examples that were posted on the forum for NinjaTrader 7 for NinjaTrader 8. These are often requested and I felt they are good examples to have for NT8. DailyLossLimitExample_NT7 - http://ninjatrader.com/support/forum...241#post451241 (http://ninjatrader


    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Chelsea, I appreciate your example, it's helping me but still there's some confusion. I have to ask:

      1. What is the difference between: position.AveragePrice and averagePrice??
      2. What is the difference between: position.Quantity, and quantity ?
      3. Why in the NT8 guide tells as Method Parameters things like: averageFillPrice when there's not even in the example that you gave? So, the guide is wrong?

      I just want to know these values for the recent position changes when this method is called after any execution.




      Looking forward.
      Thanks in advance
      Last edited by pstrusi; 11-09-2023, 09:40 AM.

      Comment


        #4
        Hello pstrusi,

        These are basically the same. The position.AveragePrice is the AveragePrice saved in the position object that is updating, while the averagePrice is the same parameter directly passed to the method. Same with the position.Quantity and quantity.

        If you have tested the script I have provided you, you should be able to see the values update after the position changes.


        I will note to our development we need to update the help guide to reflect averagePrice instead of averageFillPrice.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        85 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        143 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        83 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        256 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        334 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X