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() Vs OnBarUpdate for fast Position State

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

    OnPositionUpdate() Vs OnBarUpdate for fast Position State

    Hi,

    I know that either of these methods will give us the most current position almost at the same time for practical terms, however, I'd like to know which will it update first in milliseconds since I'm not sure about internals logic with asynchronous procedures.

    Thanks in advance

    #2
    Hello pstrusi,

    OnBarUpdate updates when a bar closes.


    If you have a 1 minute bar, and your position updates just after the bar opens, you wouldn't know until almost a full minute.

    OnPositionUpdate updates when the position updates. This would immediately when the positions updates.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I was having in mind, more tick by tick...would it still be the same? I apologize for not to tell that as previous detail.

      Thanks Chelsea
      Last edited by pstrusi; 03-27-2017, 06:05 AM.

      Comment


        #4
        Hello pstrusi,

        Thanks for your reply.

        In the tick by tick processing of OnBarUpdate, it is possible there could be multiple ticks processed before the OnPositionUpdate occurs as this is dependent upon communications and order processing times with the exchanges/brokers.

        To give you an example, go to Tools>Options>Simulator and note the built-in simulation values for delay of communications to broker is 75 mS and exchange is 150 mS. Again these are times for the simulator account only. A real account would likely have different values which would be dependent upon dynamic real time conditions of the internet connections and broker/exchanges. In any case, you can see why OnBarUpdate and OnPositionUpdate are necessarily asynchronous.
        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by The_Sec, Today, 02:29 PM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by jeronymite, 04-12-2024, 04:26 PM
        2 responses
        29 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by Mindset, 05-06-2023, 09:03 PM
        10 responses
        265 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by michi08, 10-05-2018, 09:31 AM
        5 responses
        743 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by tsantospinto, 04-12-2024, 07:04 PM
        4 responses
        63 views
        0 likes
        Last Post aligator  
        Working...
        X