Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnMarketDepth vs MarketDepth

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

    OnMarketDepth vs MarketDepth

    Hello,

    I use the SampleMarketDepth.cs template to build and print the OrderBook.
    I was wondering differences between this approach vs use the MarketDepthRows collection on MarketDepth member of MarketDepthEventArgs.
    I have checked both approaches printing them at the same time, mostly they are similar but there are differences also. What is best method? Has sense use SampleMarketDepth.cs approach if MartketDepth has valid data?

    Thank you

    #2
    jbesada, sorry I'm not sure what you're comparing here exacly, there's only one OnMarketDepth() method to access Level 2 data - http://www.ninjatrader.com/support/h...arketdepth.htm

    This would be the one that's used in our reference sample as well.

    Comment


      #3
      Yes, I Know it. My question is differences between building the OrderBook using the SampleMarketDepth.cs template vs using directly the MarketDepth member of MarketDepthEventArgs than comes in the same event.
      So, has sense built ‘manually’ the OrderBook vs use the rows collection contained in the same event?
      In the template:

      // Prints the L2 Ask Book we created. Cycles through the whole List and prints the contained objects.
      for (int idx = 0; idx < askRows.Count; idx++)
      Print("Ask Price=" + askRows[idx].Price + " Volume=" + askRows[idx].Volume + " Position=" + idx);

      // Prints the L2 Bid Book we created. Cycles through the whole List and prints the contained objects.
      for (int idx = 0; idx < bidRows.Count; idx++)
      Print("Bid Price=" + bidRows[idx].Price + " Volume=" + bidRows[idx].Volume + " Position=" + idx);

      VS printing directly MarketDepthRow[].
      Hope it is clearer now.
      Thank you

      Comment


        #4
        jbesada, we would suggest sticking to the template provided with the reference sample, this has been tested and would be the recommended way to approach this.

        Comment


          #5
          OK thank you. So, the MarketDepth class is not reliable? Why is visible then?
          What is the meaning of this member?
          Please find the attachement showing where this member comes (just to be secure we are talking about the same thing).

          Thank you
          Attached Files

          Comment


            #6
            Generally in NinjaScript, there could be more 'visible' than what we would support / document officially. Our recommendation would still stand to work with the outlined methods / snippets from the sample reference.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            648 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            369 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
            573 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            575 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X