Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 fx.practic, 10-15-2013, 12:53 AM
        5 responses
        5,406 views
        0 likes
        Last Post Bidder
        by Bidder
         
        Started by Shai Samuel, 07-02-2022, 02:46 PM
        4 responses
        98 views
        0 likes
        Last Post Bidder
        by Bidder
         
        Started by DJ888, Yesterday, 10:57 PM
        0 responses
        8 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by MacDad, 02-25-2024, 11:48 PM
        7 responses
        160 views
        0 likes
        Last Post loganjarosz123  
        Started by Belfortbucks, Yesterday, 09:29 PM
        0 responses
        9 views
        0 likes
        Last Post Belfortbucks  
        Working...
        X