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