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

SuperDOM MarketDepth Column

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

    SuperDOM MarketDepth Column

    Hello,

    I am trying to create a SuperDom column that would display MarketDepth as a profile. I found information on getting MarketDepth from https://ninjatrader.com/support/help...on_builder.htm but I don't know how to go about this.

    Any advice is greatly appreciated.

    #2
    Hello KINGKODA,

    Thanks for your post.

    If you add the existing Volume column to the Superdom and then change the "type" from "Standard" to "BuySell" and tick "show volume text" that would show the buy/sell volume at each price level (Volume profile). You can use the code of the existing Volume Column as perhaps a starting point.and subscribe to market depth data: https://ninjatrader.com/support/help...arketdepth.htm

    If you need assistance in creating your column, we can provide references to 3rd party programmers who could meet your needs.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hello KINGKODA,

      I also wanted to add the references to the help guide for superdom ninjascript: https://ninjatrader.com/support/help...dom_column.htm
      Paul H.NinjaTrader Customer Service

      Comment


        #4
        Thank you very much Paul!

        Comment


          #5
          I have not been able to produce any results on NinjaScript Output.

          Here is my code so far.
          Code:
          private SortedDictionary<double, long> Asks;
          private SortedDictionary<double, long> Bids;
          private MarketDepth<MarketDepthRow> marketDepth;
          
          private void OnMarketDepth(object sender, MarketDepthEventArgs e)
          {
               for (int i = 0; i < marketDepth.Asks.Count; i++)
               {Asks.Add(marketDepth.Asks[i].Price, marketDepth.Asks[i].Volume);}
          
               for (int i = 0; i < marketDepth.Bids.Count; i++)
               {Bids.Add(marketDepth.Bids[i].Price, marketDepth.Bids[i].Volume);}
          }
          
          private void OnBarsUpdate(object sender, BarsUpdateEventArgs e)
          {
               foreach(KeyValuePair<double,long> kvp in Asks)
               {Print(string.Format("Asks Price: {0} Volume: {1}", kvp.Key, kvp.Value));}
          
               foreach(KeyValuePair<double,long> kvp in Bids)
               {Print(string.Format(" Bids Price: {0} Volume: {1}", kvp.Key, kvp.Value));}
          }
          Any advice?
          Last edited by KINGKODA; 05-30-2019, 10:14 AM.

          Comment


            #6
            Hello KINGKODA,

            Thanks for your reply.

            Do you have any compile errors?

            If not, do you have any run time errors (as would be found in the "log" tab of the control center)?

            You may want to use additional prints to find out where in the script you have any errors are occurring.
            Paul H.NinjaTrader Customer Service

            Comment


              #7
              The error is coming from the Add to SortedDictionary section.

              Comment


                #8
                Hello KINGKODA,

                Thanks for your reply.

                Is this a compile error or a run-time error?

                Can you provide the error message?
                Paul H.NinjaTrader Customer Service

                Comment


                  #9
                  Error Message:

                  Failed to call 'Add' method: System.NullReferenceException: Object reference not set to an instance of an object.
                  at NinjaTrader.NinjaScript.SuperDomColumns.Profile.On BarsUpdate(Object sender, BarsUpdateEventArgs e)
                  at NinjaTrader.Data.BarsRequest.OnBarsUpdate(Object sender, BarsUpdateEventArgs e)
                  at NinjaTrader.Data.BarsSeries.Add(Bars bars, Double open, Double high, Double low, Double close, DateTime time, Int64 volume, Double tickSize, Boolean isBar, Double bid, Double ask)

                  Comment


                    #10
                    Hello KINGKODA,

                    Thanks for your reply.

                    I do not see where that error relates to the code you have provided.

                    If I may suggest starting with a new superdom column, as created by the Ninjascript wizard. and then test with the example in the help guide here: https://ninjatrader.com/support/help...arketdepth.htm

                    Paul H.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by AttiM, 02-14-2024, 05:20 PM
                    10 responses
                    179 views
                    0 likes
                    Last Post jeronymite  
                    Started by ghoul, Today, 06:02 PM
                    0 responses
                    7 views
                    0 likes
                    Last Post ghoul
                    by ghoul
                     
                    Started by Barry Milan, Yesterday, 10:35 PM
                    6 responses
                    19 views
                    0 likes
                    Last Post Barry Milan  
                    Started by DanielSanMartin, Yesterday, 02:37 PM
                    2 responses
                    13 views
                    0 likes
                    Last Post DanielSanMartin  
                    Started by DJ888, 04-16-2024, 06:09 PM
                    4 responses
                    13 views
                    0 likes
                    Last Post DJ888
                    by DJ888
                     
                    Working...
                    X