public override void ApplyTo(StockSerie stockSerie) { FloatSerie refSerie = stockSerie.GenerateSecondarySerieFromOtherSerie(StockDictionary.StockDictionarySingleton[this.parameters[0].ToString()], StockDataType.CLOSE); refSerie = refSerie.CalculateEMA((int)this.parameters[2]); FloatSerie varSerie = stockSerie.GetSerie(StockDataType.CLOSE); FloatSerie correlationSerie = varSerie.CalculateCorrelation((int)this.parameters[1], refSerie); this.series[0] = correlationSerie; this.Series[0].Name = this.Name; // Detecting events this.CreateEventSeries(stockSerie.Count); for (int i = 2; i < stockSerie.Count; i++) { this.eventSeries[0][i] = (varSerie[i - 2] < varSerie[i - 1] && varSerie[i - 1] > varSerie[i]); this.eventSeries[1][i] = (varSerie[i - 2] > varSerie[i - 1] && varSerie[i - 1] < varSerie[i]); this.eventSeries[2][i] = (varSerie[i - 1] < 0 && varSerie[i] >= 0); this.eventSeries[3][i] = (varSerie[i - 1] > 0 && varSerie[i] <= 0); } }