I have 2 custom indicators. For simplicity I wil expose my problem like this : One is very simple. it is a copy of the official EMA.cs and I call it EMA_CUSTOM.
Now I want to call EMA_CUSTOM inside My_cutom_indi_2 but it needs to be as a iSeries, because afterwards I take again the EMA of this, by calling EMA( my custom ISeries<double>, some period).
In My_cutom_indi_2, I call various indicators like this :
namespace NinjaTrader.NinjaScript.Indicators
{
public class My_cutom_indi_2: Indicator
{
< lots of things >
protected ISeries<double> _Average;
protected ISeries<double> choose_MA(int param_1, int parma_2, double param_3)
{
switch(param_1)
{
case custom_enum.enum_1 :
_Average=EMA_CUSTOM(parma_2, param_3);
break;
case custom_enum.enum_2 :
_Average=EMA(parma_2);
break;
case custom_enum.enum_3 :
_Average=HMA(parma_2);
break;
}
return _Average;
}
<lots of things >
Values[0] = EMA(choose_MA( param_1 , param_2, param_3 ), some_period )[0];
In the folder D:\Documents\NinjaTrader 8\bin\Custom\Indicators, I do Have the file EMA_CUSTOM.cs
Both my custom indicators do compile and print on the chart when I comment out ''_Average=EMA_CUSTOM(parma_2, param_3);'' in the switch of choose_MA in My_cutom_indi_2

Comment