本文整理汇总了C#中StockSerie.CalculateCCI方法的典型用法代码示例。如果您正苦于以下问题:C# StockSerie.CalculateCCI方法的具体用法?C# StockSerie.CalculateCCI怎么用?C# StockSerie.CalculateCCI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StockSerie
的用法示例。
在下文中一共展示了StockSerie.CalculateCCI方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplyTo
public override void ApplyTo(StockSerie stockSerie)
{
FloatSerie cciSerie = stockSerie.CalculateCCI((int)this.parameters[0]);
int period1 = ((int)this.parameters[1]);
int period2 = ((int)this.parameters[2]);
cciSerie = period1 <= 1 ?
cciSerie :
cciSerie.CalculateEMA(period1);
this.series[0] = cciSerie;
this.series[0].Name = this.Name;
FloatSerie signalSerie = cciSerie.CalculateEMA(period2);
this.series[1] = signalSerie;
this.series[1].Name = this.series[0].Name + "_SIGNAL";
// Detecting events
this.CreateEventSeries(stockSerie.Count);
for (int i = 2; i < cciSerie.Count; i++)
{
this.eventSeries[0][i] = (cciSerie[i] > signalSerie[i]);
this.eventSeries[1][i] = (cciSerie[i] < signalSerie[i]);
this.eventSeries[2][i] = eventSeries[0][i] & !eventSeries[0][i - 1];
this.eventSeries[3][i] = eventSeries[1][i] & !eventSeries[1][i - 1];
}
}
示例2: ApplyTo
public override void ApplyTo(StockSerie stockSerie)
{
int period1 = ((int)this.parameters[1]);
int period2 = ((int)this.parameters[2]);
float sigma = ((float)this.parameters[3]);
FloatSerie cciSerie = stockSerie.CalculateCCI((int)this.parameters[0]).CalculateEMA(period1);
this.series[0] = cciSerie = cciSerie.CalculateSigmoid(100f, sigma);
this.series[0].Name = this.Name;
FloatSerie signalSerie = cciSerie.CalculateEMA(period2);
this.series[1] = signalSerie;
this.series[1].Name = this.series[0].Name + "_SIGNAL";
// Detecting events
this.CreateEventSeries(stockSerie.Count);
for (int i = 2; i < cciSerie.Count; i++)
{
this.eventSeries[0][i] = (cciSerie[i] >= signalSerie[i]);
this.eventSeries[1][i] = (cciSerie[i] < signalSerie[i]);
this.eventSeries[2][i] = eventSeries[0][i] & !eventSeries[0][i - 1];
this.eventSeries[3][i] = eventSeries[1][i] & !eventSeries[1][i - 1];
this.eventSeries[4][i] = cciSerie[i] >= 0;
this.eventSeries[5][i] = cciSerie[i] < 0;
}
}