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.

Comment