I try this
[XmlIgnore()]
[Display(ResourceType = typeof(Custom.Resource), Name = "Expriry MM-YY", GroupName = "Parameters", Order = 10)]
public string ThisExpiryDate
{
get { Update(); return expiryDate; }
set { expiryDate = value; }
}
but when i call using
UpDownTradeVolumeNV().ThisExpiryDate
dont show anything in the second indicator
CODE 1
#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.LaunchPad
{
public class UpDownTradeVolumeNV : Indicator
{
private Series<double> upVolume;
private Series<double> downVolume;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Estimates the volumes higher and lower than previous trades";
Name = "UpDownTradeVolumeNV";
Calculate = Calculate.OnBarClose;
IsOverlay = true;
DisplayInDataBox = false;
DrawOnPricePanel = false;
DrawHorizontalGridLines = false;
DrawVerticalGridLines = false;
PaintPriceMarkers = false;
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)
{
}
else if (State == State.DataLoaded)
{
upVolume = new Series<double>(this);
downVolume = new Series<double>(this);
}
}
protected override void OnBarUpdate()
{
//Add your custom indicator logic here.
// Estimate the up and down volume and set the values in the
// DataSeries instance variables...
double curC = Close[0];
double curO = Open[0];
double curR = High[0] - Low[0]; // Range
double curV = Volume[0];
double uVolume;
double dVolume;
if (curC > curO)
{
uVolume = (curR / (2 * curR + curO - curC)) * curV;
}
else if (curC < curO)
{
uVolume = ((curR+curC-curO) / (2 * curR+curC-curO)) * curV;
}
else // (curC = curO)
{
uVolume = curV / 2;
}
String Zona = "UpDownTradeVolumeNV";
Debug1(Zona, "--- High[0] " + High[0]);
dVolume = curV - uVolume;
upVolume[0] = uVolume;
downVolume[0] = dVolume;
}
#region Funciones
#region Debug
//*********************************************
private bool IsDebug1 = true;
private void Debug1(String zona, String message)
{
PrintTo = PrintTo.OutputTab1;
if (IsDebug1) Print(zona +" "+message);
}
private bool IsDebug2 = true;
private void Debug2(String zona, String message)
{
PrintTo = PrintTo.OutputTab2;
if (IsDebug2) Print(zona +" "+message);
}
//**********************************************
#endregion
#endregion
#region Properties
[Browsable(false)]
[XmlIgnore()]
public Series<double> UpVolume
{
get {return upVolume;}
}
[Browsable(false)]
[XmlIgnore()]
public Series<double> DownVolume
{
get {return downVolume;}
}
#endregion
}
}
#region NinjaScript generated code. Neither change nor remove.
namespace NinjaTrader.NinjaScript.Indicators
{
public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
{
private LaunchPad.UpDownTradeVolumeNV[] cacheUpDownTradeVolumeNV;
public LaunchPad.UpDownTradeVolumeNV UpDownTradeVolumeNV()
{
return UpDownTradeVolumeNV(Input);
}
public LaunchPad.UpDownTradeVolumeNV UpDownTradeVolumeNV(ISeries<double> input)
{
if (cacheUpDownTradeVolumeNV != null)
for (int idx = 0; idx < cacheUpDownTradeVolumeNV.Length; idx++)
if (cacheUpDownTradeVolumeNV[idx] != null && cacheUpDownTradeVolumeNV[idx].EqualsInput(input))
return cacheUpDownTradeVolumeNV[idx];
return CacheIndicator<LaunchPad.UpDownTradeVolumeNV>(new LaunchPad.UpDownTradeVolumeNV(), input, ref cacheUpDownTradeVolumeNV);
}
}
}
namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
{
public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
{
public Indicators.LaunchPad.UpDownTradeVolumeNV UpDownTradeVolumeNV()
{
return indicator.UpDownTradeVolumeNV(Input);
}
public Indicators.LaunchPad.UpDownTradeVolumeNV UpDownTradeVolumeNV(ISeries<double> input )
{
return indicator.UpDownTradeVolumeNV(input);
}
}
}
namespace NinjaTrader.NinjaScript.Strategies
{
public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
{
public Indicators.LaunchPad.UpDownTradeVolumeNV UpDownTradeVolumeNV()
{
return indicator.UpDownTradeVolumeNV(Input);
}
public Indicators.LaunchPad.UpDownTradeVolumeNV UpDownTradeVolumeNV(ISeries<double> input )
{
return indicator.UpDownTradeVolumeNV(input);
}
}
}
#endregion
CODE 2
#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.LaunchPad
{
public class UpDownVolumePlot : Indicator
{
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @" Plots the estimated volumes higher and lower than previous trades";
Name = "UpDownVolumePlot";
Calculate = Calculate.OnBarClose;
IsOverlay = false;
DisplayInDataBox = true;
DrawOnPricePanel = false;
DrawHorizontalGridLines = true;
DrawVerticalGridLines = true;
PaintPriceMarkers = false;
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(new Stroke(Brushes.Green, 2), PlotStyle.Bar, "UpVol");
AddPlot(new Stroke(Brushes.Red, 2), PlotStyle.Bar, "DownVol");
AddPlot(Brushes.Gray, "ZeroLine");
}
else if (State == State.Configure)
{
}
}
protected override void OnBarUpdate()
{
//Add your custom indicator logic here.
UpVol[0] = UpDownTradeVolumeNV().UpVolume[0];
DownVol[0] = -UpDownTradeVolumeNV().DownVolume[0];
}
#region Funciones
#region Debug
//*********************************************
private bool IsDebug1 = true;
private void Debug1(String zona, String message)
{
PrintTo = PrintTo.OutputTab1;
if (IsDebug1) Print(zona +" "+message);
}
private bool IsDebug2 = true;
private void Debug2(String zona, String message)
{
PrintTo = PrintTo.OutputTab2;
if (IsDebug2) Print(zona +" "+message);
}
//**********************************************
#endregion
#endregion
#region Properties
[Browsable(false)]
[XmlIgnore]
public Series<double> UpVol
{
get { return Values[0]; }
}
[Browsable(false)]
[XmlIgnore]
public Series<double> DownVol
{
get { return Values[1]; }
}
[Browsable(false)]
[XmlIgnore]
public Series<double> ZeroLine
{
get { return Values[2]; }
}
#endregion
}
}

Comment