Indicator as DataSeries

Created at 20 Sep 2018, 02:42
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
JU

julioc1010

Joined 27.11.2016

Indicator as DataSeries
20 Sep 2018, 02:42


Hi Everyone,

I am trying develop e Robot using a TriangularMovingAverage with CommodityChannelIndex. In cTrader, we can put a CommodityChannelIndex and after put a TriangularMovingAverage  USING AS SOURCE this CommodityChannelIndex.

So, how can I write in C# to TriangularMovingAverage accept the CommodityChannelIndex in parameter method?

 

I tried write:

cci01 = Indicators.CommodityChannelIndex(CCI_Period);
DataSeriesCCI = CreateDataSeries();
tma01 = Indicators.TriangularMovingAverage(DataSeriesCCI, MA_Period);

 

and: (because i am tring many ways)

DataSeriesCCI[0] = cci01.Result.LastValue;
for (int i = 1; i <= 50; i++)
{
     DataSeriesCCI[i] = cci01.Result.Last(i);
 }

 for (int i = 0; i <= 50; i++)
{
     tma01.Calculate(i);
}

 

considering:

CommodityChannelIndex cci01;
TriangularMovingAverage tma01;
IndicatorDataSeries DataSeriesCCI;

 

 

When I print the value of    tma01.Result.Last(1), for example, shows    17/08/2018 00:00:00.255 | tma01.Result.Last(1): NaN

 

Do anyone know the correct way to write in Robots?

 

Regards...


@julioc1010
Replies

PanagiotisCharalampous
20 Sep 2018, 10:13

Hi julioc1010,

See below

var cci01 = Indicators.CommodityChannelIndex(CCI_Period);
var tma01 = Indicators.TriangularMovingAverage(cci01.Result, MA_Period);

Best Regards,

Panagiotis


@PanagiotisCharalampous