Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT8 MarketDepth and MarketData collections replacements

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

    NT8 MarketDepth and MarketData collections replacements

    Hi,
    In NT7 I built strategies relying on the MarketDepth and MarketData collections that appear in OnMarketData or OnMarketDepth. Each time I got disconnected I updated my values from there.

    Now, in NT8 I see these collections are no longer present.
    1. How do I access them? Are they the same as Instrument.MarketDepth and Instrument.MarketData?
    2. Do they update in realtime like in NT7 (asynchronously) or lagging by the events process time?
    3. In OnMarketData the "bid" and "ask" properties are updating only when "Ask" or "Bid" events occur or are they updating in real time asynchronously?

    #2
    Hello ToMer_K,

    Collections are part of C#.

    For both NinjaTrader 7 and NinjaTrader 8 you would need to use the full namespace or add a using declaration.

    For example:
    private System.Collections.Generic.List<bool> myList = new System.Collections.Generic.List<bool>();

    This line of code would work in NinjaTrader 7 or NinjaTrader 8.


    These are updated when you update them. They are not part of NinjaScript but are part of C#.
    An example of using a List can be found in the 'Level II data book' reference sample linked below.
    http://ninjatrader.com/support/forum...ead.php?t=5965
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi ChelseaB,
      The question was not about collections but about the 2 specific collections of MarketDataEventArgs and MarketDepthEventArgs.

      I saw that you added the NT8 version of the order book creation so I understood that the answer to (1) was yes.

      You haven't answered questions (2) and (3) so I guess I will have to test and find out in the hard way.

      Thanks.

      Comment


        #4
        Hello ToMer_K,

        I am not following.

        Below is a link to the help guide on MarketDataEventArgs.
        http://ninjatrader.com/support/helpG...aeventargs.htm

        I am not aware of any collections within the MarketDataEventArg(uments) class in NinjaTrader 7.

        Can you further elaborate on the exact item you are referring to?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          e.Instrument.MarketDepth and e.Instrument.MarketData
          And in (3) I am talking about e.ask and e.bid

          Comment


            #6
            Hi ToMer_K,

            I am not able to find these collections with the MarketDataEventArgs.

            Below is a link to a video I created while looking for these.
            http://screencast.com/t/ae6shHcB

            Do keep in mind, that the items you have mentioned are not in the NT7 help guide meaning these are undocumented (if they exist) and may not be created in NT8.

            Can you create an example script that calls the collection you are looking for? This may help me to verify what this is and if this is has not been added to NT8 or if this has been changed or moved.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hi ChelseaB,
              Thanks for the video.

              I was talking about OnMarketDepth event for the e.Instrument.MarketDepth.Asks and e.Instrument.MarketDepth.Bids.

              The Instrument.MarketData and Instrument.MarketDepth (without the e) can be accessed outside the OnMarketData and OnMarketDepth events. I can get the ask price ,for instance, with Instrument.MarketData.Ask.Price.

              I will ask my remaining questions again in a clearer way maybe:
              1. Do MarketData and MarketDepth collections (stated above) update asynchronously? In a way that they are more updated than the sequence of OnMarketData and OnMarketDepth events?
              2. In OnMarketData, the e.bid and e.ask properties, during a "last" event are updated through OnMarketData "bid" and "ask" events or are they updated asynchronously (like MarketData collection stated above)?

              These questions are multi thread environment related.
              Last edited by ToMer_K; 07-05-2016, 05:23 PM.

              Comment


                #8
                Hello ToMer_K,

                Originally posted by ToMer_K View Post
                I was talking about OnMarketDepth event for the e.Instrument.MarketDepth.Asks and e.Instrument.MarketDepth.Bids.

                The Instrument.MarketData and Instrument.MarketDepth (without the e) can be accessed outside the OnMarketData and OnMarketDepth events. I can get the ask price ,for instance, with Instrument.MarketData.Ask.Price.
                This does not appear to be a collection.
                Do you have a simple example script to demonstrate that you can export and post?

                Originally posted by ToMer_K View Post
                Do MarketData and MarketDepth collections (stated above) update asynchronously? In a way that they are more updated than the sequence of OnMarketData and OnMarketDepth events?
                OnMarketData and other data driven events are all driven by a single thread that receives data in the background. These are not asynchronous and are processed in the order received. However, your script and the rest of the UI, is being processed on another thread.
                There are basically 2 main threads of NT 7, the data thread and the UI thread. This means that bid and ask (running on the same data thread) are processed synchronously.
                All NinjaScripts process on the UI thread.

                Originally posted by ToMer_K View Post
                In OnMarketData, the e.bid and e.ask properties, during a "last" event are updated through OnMarketData "bid" and "ask" events or are they updated asynchronously (like MarketData collection stated above)?
                Yes, the properties of the MarketDataEventArgs are updated with each market data event.
                The last tick is going to be either the ask or the bid which ever was the last actual trade.
                Attached is an example to demonstrate.
                Attached Files
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Hi ChelseaB,
                  Thanks again.
                  I managed to get the answers to the asynchronous nature of these "Collections" by printing their output alongside the event calls data. While we process data in the UI thread there are containers that hold the most recent data.

                  I will let you know if there is more that I do not understand from trial and error.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  656 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  371 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  109 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  574 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  579 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X