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

OnPositionUpdate Questions

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

    OnPositionUpdate Questions

    When I use OnPositionUpdate I notice this method is driven twice for each event when using "live data". Historical data it is only driven once. The properties of the two events are identical so it would seem that the second one is a duplicate. I am running a 1-min ES using Zen-Fire and the strategy is SampleOnOrderUpdate where I added a PRINT statement to the OnPositionUpdate method to print all the properties.

    Also, why isn't the "time" of the position change included as a property in OnPositionUpdate just like OnOrderUpdate and OnExecution?

    And last, is there any practical reason to use OnPositionUpdate since OnExecution always precedes it? Or is it possible to access Position.MarketPosition from OnExecution and not be returned the correct Market Position?

    #2
    Thanks for reporting this, I suspect it should not fire twice for each position change.

    - There is no time property since in the NT core it is not relevant however, you could use DateTime.Now when the event is fired to store the time of change.

    - Accessing the position property should be accurate if you call it from within OnExecution() as we internally ensure everything is in sync --> Expected behaviour. If this is not what you experience, let us know.
    - Working on either method is user choice.
    RayNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by zstheorist, Today, 07:52 PM
    0 responses
    3 views
    0 likes
    Last Post zstheorist  
    Started by pmachiraju, 11-01-2023, 04:46 AM
    8 responses
    149 views
    0 likes
    Last Post rehmans
    by rehmans
     
    Started by mattbsea, Today, 05:44 PM
    0 responses
    5 views
    0 likes
    Last Post mattbsea  
    Started by RideMe, 04-07-2024, 04:54 PM
    6 responses
    33 views
    0 likes
    Last Post RideMe
    by RideMe
     
    Started by tkaboris, Today, 05:13 PM
    0 responses
    5 views
    0 likes
    Last Post tkaboris  
    Working...
    X