it's simple : work on historical data with dataseries and plot difference between up and down volume reference to close candle it's similar to cumulative delta volume
here code:
#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
#endregion
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
[Description("Enter the description of your new custom indicator here")]
public class DVOL1 : Indicator
{
#region Variables
// Wizard generated variables
// User defined variables (add any user defined variables below)
private DataSeries xvol;
#endregion
/// <summary>
/// This method is used to configure the indicator and is called once before any bar data is loaded.
/// </summary>
protected override void Initialize()
{
Add(new Plot(Color.Green, "DVOL1"));
Add(new Line(Color.Black, 0, "Zero line"));
xvol = new DataSeries(this);
// CalculateOnBarClose = true;
Overlay = false;
PriceTypeSupported = false;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if (Close[0] > Close[1]){
xvol.Set(1);}
else {
xvol.Set(0);}
}
}
#region Properties
#endregion
}
#region NinjaScript generated code. Neither change nor remove.
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
public partial class Indicator : IndicatorBase
{
private DVOL1[] cacheDVOL1 = null;
private static DVOL1 checkDVOL1 = new DVOL1();
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public DVOL1 DVOL1()
{
return DVOL1(Input);
}
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public DVOL1 DVOL1(Data.IDataSeries input)
{
if (cacheDVOL1 != null)
for (int idx = 0; idx < cacheDVOL1.Length; idx++)
if (cacheDVOL1[idx].EqualsInput(input))
return cacheDVOL1[idx];
DVOL1 indicator = new DVOL1();
indicator.BarsRequired = BarsRequired;
indicator.CalculateOnBarClose = CalculateOnBarClose;
indicator.Input = input;
indicator.SetUp();
DVOL1[] tmp = new DVOL1[cacheDVOL1 == null ? 1 : cacheDVOL1.Length + 1];
if (cacheDVOL1 != null)
cacheDVOL1.CopyTo(tmp, 0);
tmp[tmp.Length - 1] = indicator;
cacheDVOL1 = tmp;
Indicators.Add(indicator);
return indicator;
}
}
}
// This namespace holds all market analyzer column definitions and is required. Do not change it.
namespace NinjaTrader.MarketAnalyzer
{
public partial class Column : ColumnBase
{
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.DVOL1 DVOL1()
{
return _indicator.DVOL1(Input);
}
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public Indicator.DVOL1 DVOL1(Data.IDataSeries input)
{
return _indicator.DVOL1(input);
}
}
}
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
public partial class Strategy : StrategyBase
{
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.DVOL1 DVOL1()
{
return _indicator.DVOL1(Input);
}
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public Indicator.DVOL1 DVOL1(Data.IDataSeries input)
{
if (InInitialize && input == null)
throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");
return _indicator.DVOL1(input);
}
}
}
#endregion
i think something is wrong it's no work and no plot hope i must add a for cycle or other things
many thanks for someone helps...

Comment