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 Level II Data

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

    Storing Level II Data

    Hello Community!

    Is there a way to store Level II data every time it changes or udpates so the previous value can be accessed? There is a great thread http://ninjatrader.com/support/forum...ead.php?t=3478 that shows how to create your own Level II indicator but I would like to take this a step further.

    My ultimate goal is to compare the most current Level II data in the 0 position to the value it was just prior to a change or update. For example, if the volume was showing as 1500 bid at the zero position price then all of a sudden it drops to less than 250; I would to be able to trigger into some logic.

    I tried storing as a DataSeries object but was unsuccessful. Any insight would be greatly appreciated.


    Brian

    #2
    Hello brirob14,

    I built an indicator which will print to the output window anytime the quantity offered on the best ask changes.

    The way it works is if the ask price of the best ask remains the same, OnMarketData is triggered, and the quantity of the offer for the best ask is not the same as the previous quantity, you will see a print to the output window.

    I used the two year note futures contract to test and have provided a screen shot with arrows pointing out how the most recent volume quantity becomes the 2nd upon a change in quantity.

    You could use the logic to build what you are looking to do.

    Please let us know if you need further assistance.
    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the great code example Alan although I have not made the switch yet to NT8. I have pretty much transferred the code to NT7 all except for the "OnStateChange" function which is not available in 7 it seems. Would you be so kind as to provide some insight on how to duplicate the functionality of this section of code for NT7?

      Thanks.


      Brian

      Comment


        #4
        Hello brirob14,

        You could omit the else if(State ==State.Historical) section of OnStateChange as the sample I put together returns if state is historical on the first line of OnBarUpdate. The initlizing of the data series would be put in Initialize section of NT7.

        You may find the following link about code breaking changes from the NT8 helpguide helpful for converting that sample to NT7,



        Please let us know if you need further assistance.
        Alan P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by ScottWalsh, 04-16-2024, 04:29 PM
        7 responses
        34 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by cls71, Today, 04:45 AM
        0 responses
        5 views
        0 likes
        Last Post cls71
        by cls71
         
        Started by mjairg, 07-20-2023, 11:57 PM
        3 responses
        214 views
        1 like
        Last Post PaulMohn  
        Started by TheWhiteDragon, 01-21-2019, 12:44 PM
        4 responses
        547 views
        0 likes
        Last Post PaulMohn  
        Started by GLFX005, Today, 03:23 AM
        0 responses
        3 views
        0 likes
        Last Post GLFX005
        by GLFX005
         
        Working...
        X