Announcement

Collapse
No announcement yet.

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.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        149 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        84 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        129 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        125 views
        1 like
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        102 views
        0 likes
        Last Post CarlTrading  
        Working...
        X