Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Ploting Volume on Minute chart from Volumetric Bar Statistics

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

    Ploting Volume on Minute chart from Volumetric Bar Statistics

    Hi,

    I am trying to plot buy volume only on a minute (Time period) chart and trying to get the buy volume from Volumetric bar statistics. And as I am going to use on Forex intrument, I have use the DeltaType UpDownTick. So far, my script working on a Volumetric chart, but not on Time priod charts. My script is so far like below:


    #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.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.ShohaagIndicato rs
    {
    public class ShohaagBuyVolumeUpDownTick : Indicator
    {
    private Cbi.Instrument instrument;

    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = "Plots Buy volume seperately";
    Name = "ShohaagBuyVolumeUpDownTick";
    BarsRequiredToPlot = 1;
    Calculate = Calculate.OnEachTick;
    DrawOnPricePanel = false;
    IsOverlay = false;
    DisplayInDataBox = true;


    AddPlot(new Stroke(Brushes.DarkCyan, 2), PlotStyle.Bar, NinjaTrader.Custom.Resource.BuySellVolumeBuys);

    }
    else if (State == State.Configure)
    {
    // Add a 1 minute Order Flow Volumetric Bars object for the ES 03-18 contract - BarsInProgress index = 1

    AddVolumetric("this", BarsPeriodType.Minute, 1, VolumetricDeltaType.UpDownTick, 1);
    }

    }



    protected override void OnBarUpdate()
    {
    // if (CurrentBar < 1)//|| CurrentBar < 1)
    // return;
    // if (CurrentBars[0] < 0 || CurrentBars[1] <0 )
    // return;

    if (Bars == null)
    return;



    NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe barsType = BarsArray[1].BarsType as//Bars.BarsSeries.BarsType as
    NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe;

    if (barsType == null)
    return;
    if (BarsInProgress == 0)
    return;

    // if (BarsInProgress == 1)

    Value[0] = barsType.Volumes[CurrentBar].TotalBuyingVolume;

    }
    }
    }

    #region NinjaScript generated code. Neither change nor remove.

    namespace NinjaTrader.NinjaScript.Indicators
    {
    public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
    {
    private ShohaagIndicators.ShohaagBuyVolumeUpDownTick[] cacheShohaagBuyVolumeUpDownTick;
    public ShohaagIndicators.ShohaagBuyVolumeUpDownTick ShohaagBuyVolumeUpDownTick()
    {
    return ShohaagBuyVolumeUpDownTick(Input);
    }

    public ShohaagIndicators.ShohaagBuyVolumeUpDownTick ShohaagBuyVolumeUpDownTick(ISeries<double> input)
    {
    if (cacheShohaagBuyVolumeUpDownTick != null)
    for (int idx = 0; idx < cacheShohaagBuyVolumeUpDownTick.Length; idx++)
    if (cacheShohaagBuyVolumeUpDownTick[idx] != null && cacheShohaagBuyVolumeUpDownTick[idx].EqualsInput(input))
    return cacheShohaagBuyVolumeUpDownTick[idx];
    return CacheIndicator<ShohaagIndicators.ShohaagBuyVolumeU pDownTick>(new ShohaagIndicators.ShohaagBuyVolumeUpDownTick(), input, ref cacheShohaagBuyVolumeUpDownTick);
    }
    }
    }

    namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
    {
    public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
    {
    public Indicators.ShohaagIndicators.ShohaagBuyVolumeUpDow nTick ShohaagBuyVolumeUpDownTick()
    {
    return indicator.ShohaagBuyVolumeUpDownTick(Input);
    }

    public Indicators.ShohaagIndicators.ShohaagBuyVolumeUpDow nTick ShohaagBuyVolumeUpDownTick(ISeries<double> input )
    {
    return indicator.ShohaagBuyVolumeUpDownTick(input);
    }
    }
    }

    namespace NinjaTrader.NinjaScript.Strategies
    {
    public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
    {
    public Indicators.ShohaagIndicators.ShohaagBuyVolumeUpDow nTick ShohaagBuyVolumeUpDownTick()
    {
    return indicator.ShohaagBuyVolumeUpDownTick(Input);
    }

    public Indicators.ShohaagIndicators.ShohaagBuyVolumeUpDow nTick ShohaagBuyVolumeUpDownTick(ISeries<double> input )
    {
    return indicator.ShohaagBuyVolumeUpDownTick(input);
    }
    }
    }

    #endregion

    Is there anyone who can help me to successfully complete this. Any help from NT team will be appreciated.

    #2
    Hello asmmbillah,

    Thank you for the post.

    The problem is in the AddVolumetric() method. You must enter the name of an instrument to add the volumetric bars for. For a forex instrument it would be written like so:

    else if (State == State.Configure)
    {
    AddVolumetric("EURUSD", BarsPeriodType.Minute, 1, VolumetricDeltaType.BidAsk, 1);
    }

    Please let me know if I can assist further.

    Comment


      #3
      Thanks very much.

      Comment

      Latest Posts

      Collapse

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