public override void ApplyTo(StockSerie stockSerie)
        {
            using (MethodLogger ml = new MethodLogger(this))
             {
            FloatSerie fastMom = stockSerie.CalculateBuySellMomemtum((int)this.parameters[0], (bool)this.parameters[1]);
            this.series[0] = fastMom;
            this.Series[0].Name = this.Name;

            if (this.series[0] != null && this.Series[0].Count > 0)
            {
               this.CreateEventSeries(stockSerie.Count);

               FloatSerie upExLimit = new FloatSerie(stockSerie.Count, this.SerieNames[1]);
               FloatSerie downExLimit = new FloatSerie(stockSerie.Count, this.SerieNames[2]);
               FloatSerie highSerie = stockSerie.GetSerie(StockDataType.HIGH);
               FloatSerie lowSerie = stockSerie.GetSerie(StockDataType.LOW);
               for (int i = 1; i < this.SeriesCount; i++)
               {
                  this.Series[i] = new FloatSerie(stockSerie.Count, this.SerieNames[i]);
               }
               FloatSerie indicatorToDecorate = this.Series[0];
               float exhaustionSellLimit = indicatorToDecorate[0];
               float exhaustionBuyLimit = indicatorToDecorate[0];
               float exhaustionBuyPrice = highSerie[0];
               float exhaustionSellPrice = lowSerie[0];
               float exFadeOut = (100.0f - (float)this.parameters[2]) / 100.0f;

               float previousValue = indicatorToDecorate[0];
               float currentValue;

               for (int i = 1; i < indicatorToDecorate.Count - 1; i++)
               {
                  currentValue = indicatorToDecorate[i];

                  if (currentValue < previousValue)
                  {
                     if (indicatorToDecorate.IsBottom(i))
                     {
                        if (currentValue <= exhaustionSellLimit)
                        {
                           // This is an exhaustion selling
                           exhaustionSellPrice = lowSerie[i];
                           exhaustionSellLimit = currentValue;
                        }
                        else
                        {
                           exhaustionSellLimit *= exFadeOut;
                        }
                        exhaustionBuyLimit *= exFadeOut;
                     }
                     else
                     { // trail exhaustion limit down
                        exhaustionSellLimit = Math.Min(currentValue, exhaustionSellLimit);
                        exhaustionBuyLimit *= exFadeOut;
                     }
                  }
                  else if (currentValue > previousValue)
                  {
                     if (indicatorToDecorate.IsTop(i))
                     {
                        if (currentValue >= exhaustionBuyLimit)
                        {
                           // This is an exhaustion selling
                           exhaustionBuyPrice = highSerie[i];
                           exhaustionBuyLimit = currentValue;
                        }
                        else
                        {
                           exhaustionSellLimit *= exFadeOut;
                        }
                        exhaustionBuyLimit *= exFadeOut;
                     }
                     else
                     { // trail exhaustion limit up
                        exhaustionBuyLimit = Math.Max(currentValue, exhaustionBuyLimit);
                        exhaustionSellLimit *= exFadeOut;
                     }
                  }
                  else
                  {
                     exhaustionSellLimit *= exFadeOut;
                     exhaustionBuyLimit *= exFadeOut;
                  }
                  previousValue = currentValue;
                  upExLimit[i] = exhaustionBuyLimit;
                  downExLimit[i] = exhaustionSellLimit;
               }
               upExLimit[indicatorToDecorate.Count - 1] = exhaustionBuyLimit;
               downExLimit[indicatorToDecorate.Count - 1] = exhaustionSellLimit;
               this.series[1] = upExLimit;
               this.series[2] = downExLimit;

               for (int i = 5; i < indicatorToDecorate.Count - 1; i++)
               {
                  this.eventSeries[0][i] = fastMom[i - 1] == upExLimit[i - 1] && fastMom[i] < fastMom[i - 1];
                  this.eventSeries[1][i] = fastMom[i - 1] == downExLimit[i - 1] && fastMom[i] > fastMom[i - 1];
               }
            }
            else
            {
               for (int i = 0; i < this.SeriesCount; i++)
               {
                  this.Series[i] = new FloatSerie(0, this.SerieNames[i]);
               }
            }
             }
        }
        public override void ApplyTo(StockSerie stockSerie)
        {
            if (!stockSerie.HasVolume)
             {
            return;
             }
             FloatSerie fastMom = stockSerie.CalculateBuySellMomemtum((int)this.parameters[0], (bool)this.parameters[1]);
             this.series[0] = fastMom;
             this.series[0].Name = this.SerieNames[0];
             FloatSerie slowMom = fastMom.CalculateEMA((int)this.parameters[0] / 2);
             this.series[1] = slowMom;
             this.series[1].Name = this.SerieNames[1];

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

             for (int i = 1; i < stockSerie.Count; i++)
             {
            this.eventSeries[0][i] = (slowMom[i - 1] > fastMom[i - 1] && slowMom[i] < fastMom[i]);
            this.eventSeries[1][i] = (slowMom[i - 1] < fastMom[i - 1] && slowMom[i] > fastMom[i]);
             }
        }