Announcement

Collapse
No announcement yet.

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, 09: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 i2w8am9ii2, Today, 04:36 PM
                    1 response
                    2 views
                    0 likes
                    Last Post NinjaTrader_ShawnB  
                    Started by WeyldFalcon, Today, 02:07 PM
                    1 response
                    9 views
                    0 likes
                    Last Post NinjaTrader_ThomasC  
                    Started by hfwiley, Today, 03:02 PM
                    2 responses
                    16 views
                    0 likes
                    Last Post hfwiley
                    by hfwiley
                     
                    Started by pdennis, Today, 02:34 PM
                    3 responses
                    15 views
                    0 likes
                    Last Post NinjaTrader_ChrisL  
                    Started by tonynt, Today, 01:47 PM
                    3 responses
                    17 views
                    0 likes
                    Last Post NinjaTrader_Kate  
                    Working...
                    X