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

OnBarUpdate

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

    OnBarUpdate

    My understanding is that OnBarUpdate() is called whenever the bid, offer, or new trade occurs.

    Suppose I want to be able to differentiate an update of the bid/offer from an update resulting from a new trade taking place.

    How do I accomplish this?

    Thank you

    #2
    Hello eqtrader,

    OnBarUpdate is called during bar updates, so these would be actual transactions. It does not get called during updates to the bid or ask prices. You would have to use OnMarketData() for this.

    The following reference sample is useful for creating your own level II book and working with market depth.
    Creating your own Level II data book (Accessing market depth)
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      So OnBarUpdate() gets updated only when a new value of volume[0] is updated from the exchange?

      Comment


        #4
        Yes, it is only updated when there are updates to bars. Volume updates are included here if it pertains to actual trades made, not bid or ask volume changes.

        See here for an overview of the different events.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          I assume that OnBarUpdate() gets called once once per bar to update OHLC and the volume when the bar interval ends ( i.e. 1-minute, or y-minute ). Are there any cases in which this function is called more than once per interval?

          Thanks

          Comment


            #6
            It is called on every incoming tick (transaction) or on bar close, depending on CalculateOnBarClose settings.
            Ryan M.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by lorem, Today, 09:18 AM
            1 response
            4 views
            0 likes
            Last Post lorem
            by lorem
             
            Started by bmartz, Today, 09:30 AM
            0 responses
            3 views
            0 likes
            Last Post bmartz
            by bmartz
             
            Started by GussJ, 03-04-2020, 03:11 PM
            14 responses
            3,244 views
            0 likes
            Last Post GussJ
            by GussJ
             
            Started by ArkansasClint, Today, 09:28 AM
            0 responses
            0 views
            0 likes
            Last Post ArkansasClint  
            Started by hazylizard, Today, 08:38 AM
            4 responses
            12 views
            0 likes
            Last Post hazylizard  
            Working...
            X