• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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.
    http://ninjatrader.com/support/helpG...nbarupdate.htm

    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.
    http://ninjatrader.com/support/helpG...tionupdate.htm
    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 NinjaCustomer, Today, 10:06 AM
        0 responses
        2 views
        0 likes
        Last Post NinjaCustomer  
        Started by crabman777, Today, 09:52 AM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by Arkadiy_B, Today, 06:43 AM
        0 responses
        2 views
        0 likes
        Last Post Arkadiy_B  
        Started by leontancfa, Today, 06:09 AM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_PatrickG  
        Started by soulfx, 12-01-2017, 08:44 AM
        3 responses
        1,020 views
        0 likes
        Last Post NinjaTrader_EricB  
        Working...
        X