public override void ApplyTo(StockSerie stockSerie)
        {
            FloatSerie slowK = stockSerie.CalculateFastOscillator((int)this.parameters[0]).CalculateEMA((int)this.parameters[1]);
             FloatSerie slowD = slowK.CalculateEMATrailStop((int)this.parameters[2],1);
             this.series[0] = slowK;
             this.series[0].Name = this.SerieNames[0];
             this.series[1] = slowD;
             this.series[1].Name = this.SerieNames[1];

             // Detecting events
             this.CreateEventSeries(stockSerie.Count);

             float overbought = (float)this.parameters[3];
             float oversold = (float)this.parameters[4];

             bool isOverSold = false;
             bool isOverBought = false;

             for (int i = 1; i < slowK.Count; i++)
             {
            this.eventSeries[0][i] = (slowD[i - 1] > slowK[i - 1] && slowD[i] < slowK[i]);
            this.eventSeries[1][i] = (slowD[i - 1] < slowK[i - 1] && slowD[i] > slowK[i]);
            isOverSold = slowK[i] <= oversold;
            isOverBought = slowK[i] >= overbought;
            this.eventSeries[2][i] = isOverBought;
            this.eventSeries[3][i] = isOverSold;
            this.eventSeries[4][i] = (!isOverSold) && this.eventSeries[3][i - 1];
            this.eventSeries[5][i] = (!isOverBought) && this.eventSeries[2][i - 1];
            this.eventSeries[6][i] = slowK[i] > slowD[i];
            this.eventSeries[7][i] = slowK[i] < slowD[i];
             }
        }
        public override void ApplyTo(StockSerie stockSerie)
        {
            FloatSerie fastK = stockSerie.CalculateFastOscillator((int)this.parameters[0]).Div(100.0f).Sub(0.5f);

             FloatSerie oscSerie = new FloatSerie(stockSerie.Count);

             int i = 0;
             StockDailyValue previousValue = null;
             float previousOSCValue = 0.0f;
             foreach (StockDailyValue dailyValue in stockSerie.Values)
             {
            if (previousValue != null)
            {
               if (fastK[i] > 0)
               {
                  previousOSCValue += (1.0f - previousOSCValue) * fastK[i];
               }
               else
               {
                  previousOSCValue -= (-1.0f - previousOSCValue) * fastK[i];
               }

               oscSerie[i] = previousOSCValue;
            }
            previousValue = dailyValue;
            i++;

             }

             this.series[0] = oscSerie;
             this.Series[0].Name = this.Name;

             FloatSerie signalSerie = oscSerie.CalculateEMA((int)this.parameters[1]);
             this.series[1] = signalSerie;
             this.series[1].Name = this.series[0].Name + "_SIGNAL";

             // Detecting events
             this.CreateEventSeries(stockSerie.Count);
             for (i = 2; i < oscSerie.Count; i++)
             {
            this.eventSeries[0][i] = (oscSerie[i] > signalSerie[i]);
            this.eventSeries[1][i] = (oscSerie[i] < signalSerie[i]);
            this.eventSeries[0][i] = eventSeries[0][i] & !eventSeries[0][i - 1];
            this.eventSeries[1][i] = eventSeries[1][i] & !eventSeries[1][i - 1];
             }
        }