public override void ApplyTo(StockSerie stockSerie) { FloatSerie longStopSerie; FloatSerie shortStopSerie; stockSerie.CalculateVolumeTrailStop((bool)this.Parameters[0], out longStopSerie, out shortStopSerie); this.Series[0] = longStopSerie; this.Series[1] = shortStopSerie; // Detecting events this.CreateEventSeries(stockSerie.Count); for (int i = 5; i < stockSerie.Count; i++) { this.Events[0][i] = !float.IsNaN(longStopSerie[i]); this.Events[1][i] = !float.IsNaN(shortStopSerie[i]); this.Events[2][i] = float.IsNaN(longStopSerie[i - 1]) && !float.IsNaN(longStopSerie[i]); this.Events[3][i] = float.IsNaN(shortStopSerie[i - 1]) && !float.IsNaN(shortStopSerie[i]); this.Events[4][i] = !float.IsNaN(longStopSerie[i - 1]) && !float.IsNaN(longStopSerie[i]) && longStopSerie[i - 1] < longStopSerie[i]; this.Events[5][i] = !float.IsNaN(shortStopSerie[i - 1]) && !float.IsNaN(shortStopSerie[i]) && shortStopSerie[i - 1] > shortStopSerie[i]; } }