public override void ApplyTo(StockSerie stockSerie) { float accelerationFactorStep = (float)this.parameters[0]; float accelerationFactorMax = (float)this.parameters[1]; FloatSerie sarSupport1; FloatSerie sarResistance1; FloatSerie sarSupport2; FloatSerie sarResistance2; float ratio = (float)this.parameters[2]; stockSerie.CalculateSAR(accelerationFactorStep, accelerationFactorStep, accelerationFactorMax, out sarSupport1, out sarResistance1, 1); stockSerie.CalculateSAR2(accelerationFactorStep / ratio, accelerationFactorStep / ratio, accelerationFactorMax / ratio, sarSupport1, sarResistance1, out sarSupport2, out sarResistance2); this.Series[0] = sarSupport1; this.Series[1] = sarResistance1; this.Series[2] = sarSupport2; this.Series[3] = sarResistance2; // Detecting events this.CreateEventSeries(stockSerie.Count); for (int i = 5; i < stockSerie.Count; i++) { this.Events[0][i] = float.IsNaN(sarResistance1[i - 1]) && !float.IsNaN(sarResistance1[i]); this.Events[1][i] = float.IsNaN(sarSupport1[i - 1]) && !float.IsNaN(sarSupport1[i]); this.Events[2][i] = float.IsNaN(sarResistance2[i - 1]) && !float.IsNaN(sarResistance2[i]); this.Events[3][i] = float.IsNaN(sarSupport2[i - 1]) && !float.IsNaN(sarSupport2[i]); } }