Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 helpwanted, Today, 03:06 AM
        1 response
        16 views
        0 likes
        Last Post sarafuenonly123  
        Started by Brevo, Today, 01:45 AM
        0 responses
        11 views
        0 likes
        Last Post Brevo
        by Brevo
         
        Started by aussugardefender, Today, 01:07 AM
        0 responses
        6 views
        0 likes
        Last Post aussugardefender  
        Started by pvincent, 06-23-2022, 12:53 PM
        14 responses
        244 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Started by TraderG23, 12-08-2023, 07:56 AM
        9 responses
        387 views
        1 like
        Last Post Gavini
        by Gavini
         
        Working...
        X