Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Block Orders

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

    Block Orders

    In the T&S windows, there is a "B" called out whenever there is block order. In ninjascript, how do I reference this block order? I am looking to draw a circle on the bar where the block order happened. How would I go about doing that? How do I also grab the size of the block order?

    #2
    Hello algospoke,

    Below is a link to the TnSVolume example you may find helpful.


    You can use a condition to check if the volume is greater than a certain size.

    if (marketDataUpdate.Volume >= 80)
    {
    Print("block");
    }
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Chelsea,

      See below for the code I am using. FYI, my indicator is set to Calculate = Calculate.OnEachTick.

      Click image for larger version

Name:	image.png
Views:	576
Size:	7.0 KB
ID:	1320114

      See below when a block order shows up on the T&S:
      Click image for larger version

Name:	image.png
Views:	574
Size:	12.5 KB
ID:	1320115

      I am confused by the results I am getting on the output window. See below. I only want it to print when I get this block order > 80. Why am I getting all these other values on my output window?

      Click image for larger version

Name:	image.png
Views:	568
Size:	22.1 KB
ID:	1320116

      Also, is there a way to print if it is block order hitting the bid or a block order hitting the ask?

      Thanks

      Comment


        #4
        Hello algospoke,

        Is this real-time data while connected to NinjaTrader brokerage?

        See the TnSPrintsExample for checking the ask and bid.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Chelsea,

          I am having the same results on real time data from Ninjatrader and on playback. Why?

          Thanks

          Comment


            #6
            Hello algospoke,

            That is unexpected and I am not reproducing this on my end testing the ES 12-24 on a 1 minute chart.

            May I have you test the original TnSVolume example without making any modifications?

            Is this also producing values that do not match the Time & Sales window?
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Chelsea,

              I ran the TnSVolume without making any modifications and it worked just fine.

              I created a new indicator and just printed the Volume. See below for the code. Please try this code and let me know if you are getting the same results as the below pic.
              HTML Code:
              #region Using declarations
              using System;
              using System.Collections.Generic;
              using System.ComponentModel;
              using System.ComponentModel.DataAnnotations;
              using System.Linq;
              using System.Text;
              using System.Threading.Tasks;
              using System.Windows;
              using System.Windows.Input;
              using System.Windows.Media;
              using System.Xml.Serialization;
              using NinjaTrader.Cbi;
              using NinjaTrader.Gui;
              using NinjaTrader.Gui.Chart;
              using NinjaTrader.Gui.SuperDom;
              using NinjaTrader.Gui.Tools;
              using NinjaTrader.Data;
              using NinjaTrader.NinjaScript;
              using NinjaTrader.Core.FloatingPoint;
              using NinjaTrader.NinjaScript.DrawingTools;
              #endregion
              
              //This namespace holds Indicators in this folder and is required. Do not change it.
              namespace NinjaTrader.NinjaScript.Indicators
              {
                  public class TEST2 : Indicator
                  {
                      protected override void OnStateChange()
                      {
                          if (State == State.SetDefaults)
                          {
                              Description                                    = @"Enter the description for your new custom Indicator here.";
                              Name                                        = "TEST2";
                              Calculate                                    = Calculate.OnBarClose;
                              IsOverlay                                    = false;
                              DisplayInDataBox                            = true;
                              DrawOnPricePanel                            = true;
                              DrawHorizontalGridLines                        = true;
                              DrawVerticalGridLines                        = true;
                              PaintPriceMarkers                            = true;
                              ScaleJustification                            = NinjaTrader.Gui.Chart.ScaleJustification.Right;
                              //Disable this property if your indicator requires custom values that cumulate with each new market data event.
                              //See Help Guide for additional information.
                              IsSuspendedWhileInactive                    = true;
                          }
                          else if (State == State.Configure)
                          {
                          }
                      }
              
                      protected override void OnBarUpdate()
                      {
                          
                      }
                      protected override void OnMarketData(MarketDataEventArgs marketDataUpdate)
                      {
                          Print(Time[0].ToString() + " Block " + marketDataUpdate.Volume);
                      }
                  }
              }
              
              #region NinjaScript generated code. Neither change nor remove.
              
              namespace NinjaTrader.NinjaScript.Indicators
              {
                  public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
                  {
                      private TEST2[] cacheTEST2;
                      public TEST2 TEST2()
                      {
                          return TEST2(Input);
                      }
              
                      public TEST2 TEST2(ISeries<double> input)
                      {
                          if (cacheTEST2 != null)
                              for (int idx = 0; idx < cacheTEST2.Length; idx++)
                                  if (cacheTEST2[idx] != null &&  cacheTEST2[idx].EqualsInput(input))
                                      return cacheTEST2[idx];
                          return CacheIndicator<TEST2>(new TEST2(), input, ref cacheTEST2);
                      }
                  }
              }
              
              namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
              {
                  public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
                  {
                      public Indicators.TEST2 TEST2()
                      {
                          return indicator.TEST2(Input);
                      }
              
                      public Indicators.TEST2 TEST2(ISeries<double> input )
                      {
                          return indicator.TEST2(input);
                      }
                  }
              }
              
              namespace NinjaTrader.NinjaScript.Strategies
              {
                  public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
                  {
                      public Indicators.TEST2 TEST2()
                      {
                          return indicator.TEST2(Input);
                      }
              
                      public Indicators.TEST2 TEST2(ISeries<double> input )
                      {
                          return indicator.TEST2(input);
                      }
                  }
              }
              
              #endregion
              
              ​
              It seems that when I use marketDataUpdate.Volume, it is showing the current bid size and ask size instead of the volume at the last trade event. See below pic circled in red and blue. Also, it is showing some weird number randomly that I circled in pink. I am using the volumetric bars 1000 tick on ES 12-24.

              Click image for larger version

Name:	image.png
Views:	619
Size:	66.8 KB
ID:	1320428

              Comment


                #8
                Hello algospoke,

                I recommend you print the marketDataUpdate.MarketDataType so that you can identify what these values are.
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                603 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                349 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                104 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                560 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                560 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X