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

Real-time Marketh Depth Indicator Reference Sample

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

    Real-time Marketh Depth Indicator Reference Sample

    I have been getting a lot of private requests from individuals asking for a referencesample of how to access market depth (order book) data for the creation of custom indicators. At the time ofthis post, accessing market depth is not part of theofficially supported NinjaScript layer. What I present here is intended for advancedprogrammers andoutside the scope of what we currently provide technical support for.

    For those interested,please take a look at theattachedreference indicator. It will show you how to attached market depth event handlers and access some of the depth events as a result.

    Ray
    Attached Files
    RayNinjaTrader Customer Service

    #2
    imported post

    Ray -

    Thanks very much for posting this. Saved a lot of researchand works great.


    Comment


      #3
      I am developing an indicator that utilizes market depth. The difficulty that I am having is showing its results on the chart. When I use Plot or DrawText methods within OnBarUpdate they work great, but are only updated once the chart moves and not when market depth changes. Putting the same commands within OnMarketDepth does not work, they are being ignored. Print method does work, but it required output window.

      I realize the Ninja does not provide support for this feature, but I want to ask if anyone had any development done with MarketDepth event. How can I display a value on the chart that changes when OnMarketDepth event is being triggered.

      Thanks,
      redduke

      Comment


        #4
        Anybody??? I thought that this feature is being used by a lot of people.
        Thanks,
        redduke

        Comment


          #5
          Originally posted by NinjaTrader_Ray View Post
          I have been getting a lot of private requests from individuals asking for a referencesample of how to access market depth (order book) data for the creation of custom indicators. At the time ofthis post, accessing market depth is not part of theofficially supported NinjaScript layer. What I present here is intended for advancedprogrammers andoutside the scope of what we currently provide technical support for.

          For those interested,please take a look at theattachedreference indicator. It will show you how to attached market depth event handlers and access some of the depth events as a result.

          Ray
          Is it possible to access this sample indicator from a strategy? I tried and got a "The name 'DepthReferenceSample' does not exist in the current context" error when I tried to compile.

          Marcus

          Comment


            #6
            Hi Marcus,

            This indicator is not accessible from a strategy. With our upcoming NT 6.5 release due out in beta late summer, you will be able to access market depth and data events directly.
            RayNinjaTrader Customer Service

            Comment


              #7
              Originally posted by RedDuke View Post
              I am developing an indicator that utilizes market depth. The difficulty that I am having is showing its results on the chart. When I use Plot or DrawText methods within OnBarUpdate they work great, but are only updated once the chart moves and not when market depth changes. Putting the same commands within OnMarketDepth does not work, they are being ignored. Print method does work, but it required output window.

              I realize the Ninja does not provide support for this feature, but I want to ask if anyone had any development done with MarketDepth event. How can I display a value on the chart that changes when OnMarketDepth event is being triggered.

              Thanks,
              redduke

              I have the same question re setting the plots from within OnMarketDepth, updating with each change in depth data. Is this possible? i have written indicators that set a plot from within OnMarketData, which work fine.

              Comment


                #8
                You should be able to. It would probably be done in the same fashion you have it as over in OnMarketData().
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  using the following variables b = e.MarketDepth.Bid.TotalVolume(5); a = e.MarketDepth.Ask.TotalVolume(5); within OnMarketDepth, i add Bid.Set(b); and Ask.Set(a); also within OnMarketDepth and get the following error:

                  Cbi.MarketDepth.MarketDepthItemAddNow: exception caught: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

                  the variables assign correctly and print in the output window, but no plots.

                  Comment


                    #10
                    jcash,

                    Those are not supported MarketDepthEventArgs. Please see this article: http://www.ninjatrader.com/support/h...DepthEventArgs
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      Got an error when trying to import the indicator. Has the file become corrupted?

                      Comment


                        #12
                        Please doubleclick on the errors listed to be taken to the offending code lines, which seem to be present in your other installed NinjaScript files. You can then work with those guidelines to compile them successfully - http://www.ninjatrader-support2.com/...ead.php?t=4678
                        BertrandNinjaTrader Customer Service

                        Comment


                          #13
                          Can't get to the stage of compiling. Can't even import.

                          Comment


                            #14
                            gartonrd,

                            Please open up the NinjaScript Editor on any file you have installed on your NinjaTrader already. Press F5 to compile and you will get a list of errors. Those errors need to be addressed before you can import.
                            Josh P.NinjaTrader Customer Service

                            Comment


                              #15
                              I tried this sample and it will not import. There are no errors in any of my NT scripts. I would suggest an updated sample.
                              Last edited by eDanny; 06-15-2009, 11:01 AM.
                              eDanny
                              NinjaTrader Ecosystem Vendor - Integrity Traders

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by jaybedreamin, Today, 05:56 PM
                              0 responses
                              2 views
                              0 likes
                              Last Post jaybedreamin  
                              Started by DJ888, 04-16-2024, 06:09 PM
                              6 responses
                              18 views
                              0 likes
                              Last Post DJ888
                              by DJ888
                               
                              Started by Jon17, Today, 04:33 PM
                              0 responses
                              1 view
                              0 likes
                              Last Post Jon17
                              by Jon17
                               
                              Started by Javierw.ok, Today, 04:12 PM
                              0 responses
                              6 views
                              0 likes
                              Last Post Javierw.ok  
                              Started by timmbbo, Today, 08:59 AM
                              2 responses
                              10 views
                              0 likes
                              Last Post bltdavid  
                              Working...
                              X