本文整理汇总了C#中StockSerie.CalculateSeasonality方法的典型用法代码示例。如果您正苦于以下问题:C# StockSerie.CalculateSeasonality方法的具体用法?C# StockSerie.CalculateSeasonality怎么用?C# StockSerie.CalculateSeasonality使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StockSerie
的用法示例。
在下文中一共展示了StockSerie.CalculateSeasonality方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplyTo
public override void ApplyTo(StockSerie stockSerie)
{
StockSerie seasonSerie = stockSerie.CalculateSeasonality();
FloatSerie seasonCloseSerie = new FloatSerie(stockSerie.Count);
int i = 0;
float previousClose = stockSerie.Values.First().CLOSE;
FloatSerie seasonClose = seasonSerie.GetSerie(StockDataType.CLOSE);
int indexOfDate;
int previousIndexOfDate = 0;
foreach (StockDailyValue dailyValue in stockSerie.Values)
{
indexOfDate = seasonSerie.IndexOf(new DateTime(2000, dailyValue.DATE.Month, dailyValue.DATE.Day));
if (indexOfDate != -1)
{
if (indexOfDate >= previousIndexOfDate)
{
seasonCloseSerie[i] = previousClose * (1 + (seasonClose[indexOfDate] - seasonClose[previousIndexOfDate]) / seasonClose[previousIndexOfDate]);
}
previousIndexOfDate = indexOfDate;
}
else
{
seasonCloseSerie[i] = previousClose;
}
previousClose = seasonCloseSerie[i];
i++;
}
this.series[0] = stockSerie.GetSerie(StockDataType.CLOSE).CalculateCorrelation(seasonCloseSerie, (int)parameters[0]);
this.Series[0].Name = this.Name;
}