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.
    JesseNinjaTrader Customer Service

    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.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by WaveAtElliot, Today, 05:11 PM
        1 response
        7 views
        1 like
        Last Post hdge4u
        by hdge4u
         
        Started by bosajin, Yesterday, 09:15 AM
        5 responses
        36 views
        0 likes
        Last Post NinjaTrader_Jim  
        Started by Dolfan, Today, 12:24 PM
        4 responses
        23 views
        0 likes
        Last Post NinjaTrader_Jim  
        Started by WeyldFalcon, Today, 11:09 AM
        7 responses
        26 views
        0 likes
        Last Post WeyldFalcon  
        Started by DTSSTS, 08-10-2020, 09:48 AM
        12 responses
        67 views
        0 likes
        Last Post DTSSTS
        by DTSSTS
         
        Working...
        X