Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Storing Data for Volume at Price

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

    Storing Data for Volume at Price

    I was able to use OnMarketData to show totals for trades executed at the Bid and Ask.

    I'd like to be able to store that data for each price (tick on ES futures) so I can see totals above and below what the current Bid and Ask are.

    Can anyone point me in the right direction?

    #2
    Hello,

    Thank you for the question.

    So you have the data you are after but you need to store the data for future use correct?

    If this is only a total, you could use a variable and simply add or subtract from that when needed.


    For example you have your OnMarketData:

    Code:
    protected override void OnMarketData(MarketDataEventArgs e)
    {
    
    }
    you would need a variable outside the scope of OnMarketData or:

    Code:
    private int total = 0;
    
    protected override void OnMarketData(MarketDataEventArgs e)
    {
    total = total + 1; 
    }
    This simple example would add 1 to the variable total every time the OnMarketData is called. This is only a simple example, instead of just adding 1 you would add your value you have already calculated from your first statement.

    If this is not what you are trying to do please let me know.

    I look forward to being of further assistance.

    Comment


      #3
      Yes, I am able to collect the data on the current bid, but I'd like to be able to collect data for every price that the ES trades at. For example, if we opened at 2070 and traded up to 2075, I would need an int for volume at 2070, 2075.25, 2070.5, etc.



      Originally posted by NinjaTrader_Jesse View Post
      Hello,

      Thank you for the question.

      So you have the data you are after but you need to store the data for future use correct?

      If this is only a total, you could use a variable and simply add or subtract from that when needed.


      For example you have your OnMarketData:

      Code:
      protected override void OnMarketData(MarketDataEventArgs e)
      {
      
      }
      you would need a variable outside the scope of OnMarketData or:

      Code:
      private int total = 0;
      
      protected override void OnMarketData(MarketDataEventArgs e)
      {
      total = total + 1; 
      }
      This simple example would add 1 to the variable total every time the OnMarketData is called. This is only a simple example, instead of just adding 1 you would add your value you have already calculated from your first statement.

      If this is not what you are trying to do please let me know.

      I look forward to being of further assistance.

      Comment


        #4
        Hello,

        Thank you for the reply.

        To clarify you are not looking for a total, but a list of prices with the total volume for each price, is this correct?

        If so you could look into the custom L2 Data Book example we have located here: http://www.ninjatrader.com/support/f...ead.php?t=3478

        This shows how to create a custom data book using the L2 data, you could take the concepts from this and apply it how you need. The main part of this is the custom List object which allows you to have a list of data that contains multiple data points.

        I look forward to being of further assistance.

        Comment

        Latest Posts

        Collapse

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