Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Access to level 2 data for the last bar

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

    Access to level 2 data for the last bar

    Dear Support,

    I used the example "Sample level2 book" indicator to access to level 2 data and it work well.

    But I need to access to level 2 value for the whole last bar, not only for the last 10 tick up and 10 tick down (which is like SuperDom)

    I don't understand how modify the code to do that

    can you help me?

    thank you, best regards

    AndreaBHS

    #2
    Hello AndreaBhs,

    Thanks for your post.

    The Sample level2 book example shows the open orders at 10 levels above and below the current price. It would not be directly related to a bar.

    Are you looking for the actual buy and sell volumes? Like the data you would find using Volumetric Bars?

    Can you clarify what your end goal is?


    Comment


      #3
      Hi Paul,

      my goal is print the value of Levels 2 above and below current price for the whole previous bar, like OrderFlow Market Depth built in (when plot is set on historical)

      At the moment I need only 1 bar (the last closed bar), not all the last bar

      Comment


        #4
        Hello AndreaBhs,

        Thanks for your reply and clarification.

        We would not have any examples of what you want to do. The Order Flow Market Depth Map code is confidential and I don't have access to it.

        There would be a number of technical hurdles to get there. You are going to have to track that information and store it per bar if you want to read the "last bar's L2 data"

        In general, we don't have any example code built for that but we think it would be possible to make a Series<Custom class> that describes a snapshot of the level2 book, and then make a Series<Level2SnapShot> that would be assigned and reset from a private/temporary Level2SnapShot object.

        The thing is, OnMarketDepth would not be called synchronously after OBU, so it would not be perfect.

        Then you would need to custom render that stuff... a lot to think about if you wanted to make a heatmap.

        I have attached an example of a series custom class, on each bar, it pulls the open and close values and stores them in the MySeriesClass.

        SeriesCustomClass.zip

        Note: In the series custom class it will default to a look back of 256 bars so you may want to set the look back to infinite, like this: MySeriesClass = new Series<MyClass>(this, MaximumBarsLookBack.Infinite);
        Attached Files
        Last edited by NinjaTrader_PaulH; 01-25-2022, 03:18 PM. Reason: Added note about look back.

        Comment


          #5
          Thank you PaulH,
          I have Ninjatrader Lifetime version, so I don't need to render, I already have OrderFlow MarketDepth Built in.
          I need Value for my custom strategy.

          I think I will use a <List> for the previous bar to store values

          Thank you, best regards,

          AndreaBHS

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          602 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          347 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          103 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          559 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          558 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X