Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MTF Volume Question

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

    MTF Volume Question

    A friend decided to take NT8 for a test drive and he sent me question that I have no answer for.

    On an ES 500 Volume Chart with a Secondary Series of 1 Volume we could never get the the two Series to Balance. In other words, when tracking the volume on the 1 Volume Series if never adds up to 500 which is the Primary Volume chart. The attached image is a png of the output window showing that the numbers do not balance. Maybe it is my computer or possibly I am suffering from a colossal case of Saturday morning cranial flatulence.

    Any suggestions to cure this issue?

    PHP Code:
    
        public class MTFVolumeQuestion : Indicator
        {
    
            private double  BIP_1_VolumeCounter;
    
            protected override void OnStateChange()
            {
                if (State == State.SetDefaults)
                {
                    Description                                    = @"Enter the description for your new custom Indicator here.";
                    Name                                        = "MTFVolumeQuestion";
                    Calculate                                    = Calculate.OnEachTick;
                    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;
                    AddPlot(Brushes.Orange, "VolumePlot");
                }
                else if (State == State.Configure)
                {
                    AddDataSeries(Data.BarsPeriodType.Volume, 1);
                }
                else if (State == State.DataLoaded)
                {
                    ClearOutputWindow();
                }
            }
    
            protected override void OnBarUpdate()
            {
                if(BarsInProgress == 0)
                {
                    Print(string.Format("\r\nBIP_0 Volume {0}     BIP_1_VolumeCounter {1}",  Volume[0], BIP_1_VolumeCounter ));
    
                    if(IsFirstTickOfBar)
                    {
                        //    Reset the BIP 1 (1 Volume) BIP_1_VolumeCounter to 0.
                        BIP_1_VolumeCounter = 0;
                        Print(string.Format("BIP 0:   **** FirstTickOfBar {0:hh:mm:ss:fff tt}   BIP_1_VolumeCounter  {1,4}", Times[0][0], BIP_1_VolumeCounter  ));
                    }
                }
                if(BarsInProgress == 1)
                {
                    //Keep a running total of volume based on the 1 Volume Chart
                    BIP_1_VolumeCounter += Volume[0];
    
                    //    This prints to many Lines.
                    //    OutputWindow Error: You have reached the maximum threshold of the NinjaScript Output window. Some of your output messages have been suppressed.
                    //    Can Uncomment and Print just the last few Bars
    //                Print(string.Format("BIP 1:   {0:hh:mm:ss:fff tt}   Vol 1:  {1,4}    BIP_1_VolumeCounter {2,3}  ", Time[0], Volume[0], BIP_1_VolumeCounter  ));
                }            
            }
    
            #region Properties
    
            [Browsable(false)]
            [XmlIgnore]
            public Series<double> VolumePlot
            {
                get { return Values[0]; }
            }
            #endregion
    
        } 
    
    Attached Files
    Last edited by TAJTrades; 01-12-2019, 09:44 AM.

    #2
    Hello TAJTrades,

    I'm doing further research and creating a demonstration.

    I appreciate your patience.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello TAJTrades,

      Building using individual ticks is very complicated and there are many considerations.

      The main consideration is that if ticks or primary bars have the same time stamp, NinjaTrader doesn't know in what sequence to process that tick (either before or after the primary).


      An example script that does a pretty good job building with a 1 tick series can be found here.


      With Volume bars this is more complicated. With Volume bars NinjaTrader will be splitting the volume from ticks between different bars and will also be splitting the volume with the primary bars as well. This can cause two primary bars to have the same time stamp and it becomes more likely that the split volume from a tick may not be processed in the expected sequence before or after the primary bar processes.
      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
      648 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      369 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      108 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      572 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      573 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X