Then I used NT8 to generated a empty indicator with 2 inputs, which in the second section of below.
But the issue is once I compile the code in NT8. The program automatically removed the second input "show".
I do want to use 2 inputs and want to know how to fixed it. thanks.
Codes in NT7 is below:
--------------------------------------------------------------------------------------------------------------
#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 ChanKline[] cacheChanKline = null;
private static ChanKline checkChanKline = new ChanKline();
public ChanKline ChanKline(int show) // input with show
{
return ChanKline(Input, show);
}
public ChanKline ChanKline(Data.IDataSeries input, int show) // two inputs
{
checkChanKline.Show = show;
show = checkChanKline.Show;
if (cacheChanKline != null)
for (int idx = 0; idx < cacheChanKline.Length; idx++)
if (cacheChanKline[idx].Show == show && cacheChanKline[idx].EqualsInput(input))
return cacheChanKline[idx];
ChanKline indicator = new ChanKline();
indicator.BarsRequired = BarsRequired;
indicator.CalculateOnBarClose = CalculateOnBarClose;
indicator.Input = input;
indicator.Show = show;
indicator.SetUp();
ChanKline[] tmp = new ChanKline[cacheChanKline == null ? 1 : cacheChanKline.Length + 1];
if (cacheChanKline != null)
cacheChanKline.CopyTo(tmp, 0);
tmp[tmp.Length - 1] = indicator;
cacheChanKline = tmp;
Indicators.Add(indicator);
return indicator;
}
}
---------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------
NT8 generated code for me:
#region NinjaScript generated code. Neither change nor remove.
namespace NinjaTrader.NinjaScript.Indicators
{
public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
{
private ChanKline[] cacheChanKline;
public ChanKline ChanKline()
{
return ChanKline(Input);
}
public ChanKline ChanKline(ISeries<double> input, show) // two inputs in beginning, but after compile, the program remove "show".
{
if (cacheChanKline != null)
for (int idx = 0; idx < cacheChanKline.Length; idx++)
if (cacheChanKline[idx] != null && cacheChanKline[idx].EqualsInput(input))
return cacheChanKline[idx];
return CacheIndicator<ChanKline>(new ChanKline(), input, ref cacheChanKline);
}
}
}
Comment