Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Level 2

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

    Level 2

    Is it possible to get the number of contracts offered at price X?

    #2
    Hello nightriderx,

    Market depth uses an index position for reference. Unfortunately it's not as simple as providing a price level to check number of contracts offered. It is possible to custom code this and this sample can help you work with market depth programatically.

    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks Ryan.
      Another question I have is what happens when the bid from the previous bar is called. ie. if I wanted to make an indicator that plots the sma of the ask price...what value would it use for the previous bar? would it be of the last tick of that bar? the avg? or something else? I am finding that these values vary dramatically from real time to recorded data...any idea why that may be? Theoretically, as I understand, they both give you the value of every new incoming tick...

      Comment


        #4
        It's challenging to sync these up because they represent different events. OnBarUpdate() is raised only when a trade occurs and OnMarketDepth() is raised for every change in level II data. The changes can be caused by trades occurring, but also orders cancelled or added at various price levels. When you access a value within OMD you're getting the last updated value within that context. You have to custom code any syncing with bar updates compared to other events like OMD.

        If you want an SMA of the ask price, best is to chart the Ask series through the right click > data series screen. You can then apply an SMA directly to this Ask series. This data is not available with all providers. See here for which ones offer historical bid / ask data.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Right but the bid/ask of the previous bar is set to the last tick (value of bid/ask of the last trade) in that previous bar...is that correct? And thus should correspond to the same exact value on live/recorded/and historical (pulled from the right provider) charts...correct? so my bid sma plot should correspond on a live chart to recorded and historical charts?

          Comment


            #6
            Right but the bid/ask of the previous bar
            There's no such thing as bid / ask of the previous bar. A standard bar represents trades that did occur, and bid / ask is the prices people are willing to receive.
            Last edited by NinjaTrader_RyanM1; 04-19-2011, 02:16 PM.
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              ok, so how is the sma of bid/ask calculated?...you need previous values...
              on what basis is the chart plotted when I select plot based on ask/bid?
              this is what I have been trying to figure out...
              Last edited by nightriderx; 04-19-2011, 02:22 PM.

              Comment


                #8
                It can be confusing, as this is a special bar built on changes to bid / ask data. Anytime the ask value changes, a value is plotted at that price level. The main distinction between an ask and last bar is the mechanism for a value change. A standard "last" bar represents only trades that actually occurred, and ask levels can change independent of this.

                To get an SMA of ask-level bars, then you have to work with an ask series, or custom code some type of synchronization working between OBU and OMD. They're really two different data sets so you're unable to simply access "the ask of the previous (standard) bar". A standard OHLC bar has only those 4 data points, and they represent the range of trades that actually occurred.
                Ryan M.NinjaTrader Customer Service

                Comment


                  #9
                  ok, so what you are saying is that there are 3 different series (at level 1) the bid, the ask and the last series, all recorded independently of the other?

                  thus the bid sma will be plotted based on the OMD series, meaning that if the bid changes 7 times within a second - it will be the sma of those 7 bid prices within that second... and if the ask changes 7 times within 4 seconds - it will be the sma of those 7 bid prices within the 4 seconds...just like if the last price was plotted on a tick basis - it would be the sma of the last 7 ticks...correct?

                  if so, can you please direct me on how I can add the OMD series (like my bid sma) to my OBU strategy/indicator?
                  Last edited by nightriderx; 04-19-2011, 04:28 PM.

                  Comment


                    #10
                    Yes, bid ask and last are all separate data streams.

                    It really depends what you have coded. You have to pass in a data series in your SMA calculation, which is synced to bars. It's hard to say what it will do without seeing a code snippet. Please share and will take a look here.

                    There are two event handlers for bid/ ask data.
                    OnMarketData - Raised with changes to best bid / ask or last.
                    OnMarketDepth() - Level II data - raised with changes to market depth, which can be up to ten levels on each side.
                    Ryan M.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by port119, Today, 02:43 PM
                    0 responses
                    1 view
                    0 likes
                    Last Post port119
                    by port119
                     
                    Started by Philippe56140, Today, 02:35 PM
                    0 responses
                    2 views
                    0 likes
                    Last Post Philippe56140  
                    Started by 00nevest, Today, 02:27 PM
                    0 responses
                    1 view
                    0 likes
                    Last Post 00nevest  
                    Started by Jonafare, 12-06-2012, 03:48 PM
                    5 responses
                    3,986 views
                    0 likes
                    Last Post rene69851  
                    Started by Fitspressorest, Today, 01:38 PM
                    0 responses
                    2 views
                    0 likes
                    Last Post Fitspressorest  
                    Working...
                    X