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