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 funk10101, Today, 09:43 PM
        0 responses
        4 views
        0 likes
        Last Post funk10101  
        Started by pkefal, 04-11-2024, 07:39 AM
        11 responses
        36 views
        0 likes
        Last Post jeronymite  
        Started by bill2023, Yesterday, 08:51 AM
        8 responses
        44 views
        0 likes
        Last Post bill2023  
        Started by yertle, Today, 08:38 AM
        6 responses
        26 views
        0 likes
        Last Post ryjoga
        by ryjoga
         
        Started by algospoke, Yesterday, 06:40 PM
        2 responses
        24 views
        0 likes
        Last Post algospoke  
        Working...
        X