示例#1
0
        public void SignalSingle_SimpleValues_Calculated()
        {
            //When
            double?result = Macd.SignalSingle(data, period: 9);

            //Then
            Assert.Equal(12.44D, Math.Round(result.Value, 2));
        }
示例#2
0
        public void HistogramSingle_SimpleValues_Calculated()
        {
            //When
            double?result = Macd.HistogramSingle(data);

            //Then
            Assert.Equal(7.92D, Math.Round(result.Value, 2));
        }
示例#3
0
        public void MacdSingle_SimpleValues_Calculated()
        {
            //When
            double?result = Macd.MacdSingle(data, fast: 12, slow: 26);

            //Then
            Assert.Equal(20.36D, Math.Round(result.Value, 2));
        }
        public SignalAndValue Process(Candle candle)
        {
            var value = Macd.Process(candle);

            return(SignalMa.Process(new Candle
            {
                CloseBid = value.Value,
                IsComplete = candle.IsComplete
            }));
        }
示例#5
0
        public static MacdItem Macd(this IEnumerable <ICandle> candles, int?fastPeriod = null, int?slowPeriod = null, int?signalPeriod = null)
        {
            fastPeriod ??= 12;
            slowPeriod ??= 26;
            signalPeriod ??= 9;

            IIndicatorOptions options = new MacdOptions(fastPeriod.Value, slowPeriod.Value, signalPeriod.Value);
            Macd macd = new Macd();

            return((MacdItem)macd.Get(candles, options));
        }
示例#6
0
        /// <summary>
        /// Called on every new bar of data.
        /// </summary>
        /// <param name="currentBar">The current bar of the simulation</param>
        protected override void OnBarUpdate(int currentBar)
        {
            base.OnBarUpdate(currentBar);

            Macd macd = (Macd)Dependents[0];

            if (DataSeries.IsAboutToCrossAbove(macd.Value, macd.Avg, currentBar) == true)
            {
                WasFound[currentBar] = true;
            }
        }
        /// <summary>
        /// Обработать входное значение.
        /// </summary>
        /// <param name="input">Входное значение.</param>
        /// <returns>Результирующее значение.</returns>
        protected override IIndicatorValue OnProcess(IIndicatorValue input)
        {
            var macdValue   = Macd.Process(input);
            var signalValue = Macd.IsFormed ? SignalMa.Process(macdValue) : new DecimalIndicatorValue(this, 0);

            var value = new ComplexIndicatorValue(this);

            value.InnerValues.Add(Macd, input.SetValue(this, macdValue.GetValue <decimal>() - signalValue.GetValue <decimal>()));
            value.InnerValues.Add(SignalMa, signalValue);
            return(value);
        }
        /// <summary>
        /// Called on every new bar of data.
        /// </summary>
        /// <param name="currentBar">The current bar of the simulation</param>
        protected override void OnBarUpdate(int currentBar)
        {
            base.OnBarUpdate(currentBar);

            Macd macd = (Macd)Dependents[0];

            if (DataSeries.CrossBelow(macd.Value, macd.Avg, currentBar, 0) != -1)
            {
                WasFound[currentBar] = true;
            }
        }
示例#9
0
        /// <summary>
        /// Called on every new bar of data.
        /// </summary>
        /// <param name="currentBar">The current bar of the simulation</param>
        protected override void OnBarUpdate(int currentBar)
        {
            base.OnBarUpdate(currentBar);

            if (currentBar < 2)
            {
                return;
            }

            Macd macd = (Macd)Dependents[0];

            if (macd.Diff[currentBar - 2] > macd.Diff[currentBar - 1] && macd.Diff[currentBar] > macd.Diff[currentBar - 1])
            {
                WasFound[currentBar] = true;
            }
        }
示例#10
0
        public override void Execute()
        {
            var macd = Macd.Get();

            if (State.Position.IsFlat)
            {
                Exchange.CancelAll();
                if (!Measurer.IsPriceVolatile)
                {
                    // open position in direction of trend
                    var side = macd < 0 ? Side.Sell : Side.Buy;
                    EnterPosition(side);
                }
            }
            else
            {
                //
            }
        }
示例#11
0
 public Prices()
 {
     Type = Price.Close;
     Map  = new Dictionary <Price, List <double> >();
     foreach (Price type in Enum.GetValues(typeof(Price)))
     {
         Map[type] = new List <double>();
     }
     FastEma = new Ema(Const.DIRECTIONAL_FAST_EMA_LENGTH);
     SlowEma = new Ema(Const.DIRECTIONAL_SLOW_EMA_LENGTH);
     Bb      = new Bb(Const.BB_WIDTH, Const.BB_PERIOD);
     //Kc = new Kc(Const.BB_WIDTH, Const.BB_PERIOD);
     //Mc = new Mc(Const.BB_PERIOD);
     Macd       = new Macd(FastEma, SlowEma, Const.MACD_SIGNAL_LENGTH);
     Rsi        = new Rsi(Const.RSI_LENGTH);
     StochRsi   = new StochRsi(Rsi, Const.STOCH_RSI_LENGTH, Const.STOCH_RSI_D_LENGTH);
     Indicators = new List <IIndicator>
     {
         FastEma, SlowEma, Bb, /*Kc,*/ /*Mc,*/ Macd, Rsi, StochRsi
     };
 }
示例#12
0
        private void BuildIndicators()
        {
            Sma.Add(5, new Sma(_candleSticks, 5, pair));
            Sma.Add(10, new Sma(_candleSticks, 10, pair));
            Sma.Add(15, new Sma(_candleSticks, 15, pair));
            Sma.Add(20, new Sma(_candleSticks, 20, pair));
            Sma.Add(40, new Sma(_candleSticks, 40, pair));
            Sma.Add(100, new Sma(_candleSticks, 100, pair));
            Ema.Add(5, new Ema(_candleSticks, 5, pair));
            Ema.Add(10, new Ema(_candleSticks, 10, pair));
            Ema.Add(15, new Ema(_candleSticks, 15, pair));
            Ema.Add(20, new Ema(_candleSticks, 20, pair));
            Ema.Add(40, new Ema(_candleSticks, 40, pair));
            Ema.Add(80, new Ema(_candleSticks, 80, pair));

            Gsma.Add(20, new Gsma(_candleSticks, 20, 10, pair));

            stochRsi = new StochRsi(_candleSticks, 14, 14, 8, 8, pair);
            rsi      = new Rsi(_candleSticks, 14, pair);
            macd     = new Macd(_candleSticks, 12, 26, 9, pair);
        }
示例#13
0
        public MacdSeries(C1FlexChart chart, string plotAreaName) : base()
        {
            Chart = chart;
            Chart.BeginUpdate();

            AxisY.TitleStyle            = new ChartStyle();
            AxisY.TitleStyle.FontWeight = FontWeights.Bold;
            AxisY.Position       = C1.Chart.Position.Right;
            AxisY.PlotAreaName   = plotAreaName;
            AxisY.Title          = "MACD";
            AxisY.Labels         = false;
            AxisY.MajorTickMarks = AxisY.MinorTickMarks = C1.Chart.TickMark.None;


            Macd series = new Macd();

            series.MacdLineStyle = new ChartStyle();
            series.MacdLineStyle.StrokeThickness = 1;
            series.SignalLineStyle = new ChartStyle();
            series.SignalLineStyle.StrokeThickness = 1;
            series.ChartType             = C1.Chart.Finance.FinancialChartType.Line;
            series.Style                 = new C1.WPF.Chart.ChartStyle();
            series.Style.StrokeThickness = 1;
            series.BindingX              = "Date";
            series.Binding               = "High,Low,Close";

            series.AxisY = AxisY;
            Chart.Series.Add(series);



            MacdHistogram histogram = new MacdHistogram();

            histogram.Style = new C1.WPF.Chart.ChartStyle();
            histogram.Style.StrokeThickness = 1;
            histogram.BindingX = "Date";
            histogram.Binding  = "High,Low,Close";


            double[] values = null;
            ViewModel.ViewModel.Instance.PropertyChanged += (o, e) =>
            {
                if (e.PropertyName == "CurrectQuote")
                {
                    values = histogram.GetValues(0); // this is the value;
                }
            };

            histogram.SymbolRendering += (sender, ev) =>
            {
                if (values == null)
                {
                    values = histogram.GetValues(0); // this is the volume value;
                }
                if (values != null)
                {
                    if (values[ev.Index] > 0)
                    {
                        if (IncreasingBar is SolidColorBrush)
                        {
                            Color c  = (IncreasingBar as SolidColorBrush).Color;
                            Color cf = Color.FromArgb(128, c.R, c.G, c.B);
                            ev.Engine.SetStroke(c.ToArgb());
                            ev.Engine.SetFill(cf.ToArgb());
                        }
                    }
                    else
                    {
                        if (DecreasingBar is SolidColorBrush)
                        {
                            Color c  = (DecreasingBar as SolidColorBrush).Color;
                            Color cf = Color.FromArgb(128, c.R, c.G, c.B);
                            ev.Engine.SetStroke(c.ToArgb());
                            ev.Engine.SetFill(cf.ToArgb());
                        }
                    }
                }
            };

            histogram.AxisY = AxisY;
            Chart.Series.Add(histogram);



            Utilities.Helper.BindingSettingsParams(chart, series, typeof(Macd), "MACD",
                                                   new Data.PropertyParam[]
            {
                new Data.PropertyParam("FastPeriod", typeof(int)),
                new Data.PropertyParam("SlowPeriod", typeof(int)),
                new Data.PropertyParam("SmoothingPeriod", typeof(int)),
                new Data.PropertyParam("MacdLineStyle.Stroke", typeof(Brush), "Series"),
                new Data.PropertyParam("SignalLineStyle.Stroke", typeof(Brush), "Series"),
            },
                                                   () =>
            {
                this.OnSettingParamsChanged();
            }
                                                   );

            //Utilities.Helper.BindingSettingsParams(chart, histogram, typeof(MacdHistogram), "MACD",
            //    new Data.PropertyParam[]
            //    {
            //        new Data.PropertyParam("Style.Stroke", typeof(Brush), "Histogram"),
            //        new Data.PropertyParam("Style.Fill", typeof(Brush), "Histogram"),
            //    },
            //    () =>
            //    {
            //        this.OnSettingParamsChanged();
            //    }
            //);

            Utilities.Helper.BindingSettingsParams(chart, this, typeof(MacdSeries), "MACD",
                                                   new Data.PropertyParam[]
            {
                new Data.PropertyParam("IncreasingBar", typeof(Brush)),
                new Data.PropertyParam("DecreasingBar", typeof(Brush)),
            },
                                                   () =>
            {
                this.OnSettingParamsChanged();
            }
                                                   );

            //binding series color to axis title.
            Binding binding = new Binding("Stroke");

            binding.Source = series.MacdLineStyle;
            BindingOperations.SetBinding(AxisY.TitleStyle, ChartStyle.StrokeProperty, binding);

            Chart.EndUpdate();

            this.Series = new FinancialSeries[] { series, histogram };
        }
示例#14
0
        public void MACD_SimpleValue_Calculated()
        {
            //When
            (double?[] macd, double?[] signal, double?[] histogram) = Macd.MACD(data);
            //Then
            double?[] expected_macd = { null,         null,         null,         null,
                                        null,         null,         null,         null,
                                        null,         null,         null,         null,
                                        null,         null,         null,         null,
                                        null,         null,         null,         null,
                                        null,         null,         null,         null,
                                        null,         null,         null,         null,
                                        null,         null,         null,         null,
                                        null,           20.9580082,  13.95922686,   7.40338135,
                                        2.13879148,    -2.55669962,  -5.11348952,  -6.71537917,
                                        -6.0232371,    -6.81231968,  -7.34892489,  -8.50724607,
                                        -9.74060601,  -10.74348795, -11.59824174, -12.11979253,
                                        -12.31052557,   -8.7299258,  -8.87640831, -10.01879309,
                                        -11.25833908, -12.16102225, -13.57524954, -14.12969828,
                                        -12.16546641, -11.76026518, -14.08883669, -16.05180483,
                                        -18.95838324, -19.12498019, -18.57886691,   -17.329019,
                                        -16.16028893,  -14.9727051, -15.11208865, -14.87756479,
                                        -13.99778039, -14.05438486, -15.64170307, -15.16348567,
                                        -14.8513383,  -13.79935574, -13.71931977, -14.96807426,
                                        -14.62316027,  -13.5840036, -12.99795205, -12.18326263,
                                        -11.54573373, -11.77620843, -12.67613923, -13.07721163,
                                        -11.85039129, -11.61569854, -10.43392275,  -7.30308505,
                                        -5.14185226,   -3.37402769,  -2.90380584,    0.9039612,
                                        4.88606972,     7.48759555,   9.59605486,  12.24346823,
                                        15.70177252,    18.3360363,  19.76417987, 20.36270627 };
            double?[] expected_signal = { null,         null,         null,         null,
                                          null,         null,         null,         null,
                                          null,         null,         null,         null,
                                          null,         null,         null,         null,
                                          null,         null,         null,         null,
                                          null,         null,         null,         null,
                                          null,         null,         null,         null,
                                          null,         null,         null,         null,
                                          null,          34.71873678,   30.5668348,  25.93414411,
                                          21.17507358,   16.42871894,  12.12027725,   8.35314596,
                                          5.47786935,     3.01983155,   0.94608026,  -0.94458501,
                                          -2.70378921,   -4.31172896,  -5.76903151,  -7.03918372,
                                          -8.09345209,   -8.22074683,  -8.35187913,  -8.68526192,
                                          -9.19987735,   -9.79210633, -10.54873497, -11.26492764,
                                          -11.44503539, -11.50808135, -12.02423242,  -12.8297469,
                                          -14.05547417, -15.06937537, -15.77127368, -16.08282274,
                                          -16.09831598,  -15.8731938, -15.72097277, -15.55229118,
                                          -15.24138902, -15.00398819, -15.13153116, -15.13792207,
                                          -15.08060531,  -14.8243554, -14.60334827, -14.67629347,
                                          -14.66566683, -14.44933418, -14.15905776, -13.76389873,
                                          -13.32026573, -13.01145427, -12.94439126, -12.97095534,
                                          -12.74684253, -12.52061373, -12.10327553, -11.14323744,
                                          -9.9429604,    -8.62917386,  -7.48410025,  -5.80648796,
                                          -3.66797643,   -1.43686203,   0.76972135,   3.06447072,
                                          5.59193108,     8.14075213,  10.46543768, 12.44489139 };
            double?[] expected_histogram = { null,         null,         null,         null,
                                             null,         null,         null,         null,
                                             null,         null,         null,         null,
                                             null,         null,         null,         null,
                                             null,         null,         null,         null,
                                             null,         null,         null,         null,
                                             null,         null,         null,         null,
                                             null,         null,         null,         null,
                                             null,         -13.76072858, -16.60760793, -18.53076276,
                                             -19.0362821,  -18.98541856, -17.23376677, -15.06852513,
                                             -11.50110645,  -9.83215122,  -8.29500515,  -7.56266106,
                                             -7.0368168,    -6.43175899,  -5.82921023,  -5.08060881,
                                             -4.21707348,   -0.50917897,  -0.52452919,  -1.33353117,
                                             -2.05846173,   -2.36891592,  -3.02651457,  -2.86477065,
                                             -0.72043102,   -0.25218383,  -2.06460427,  -3.22205793,
                                             -4.90290907,   -4.05560482,  -2.80759323,  -1.24619625,
                                             -0.06197295,     0.9004887,   0.60888412,   0.67472639,
                                             1.24360863,     0.94960333,   -0.5101719,  -0.02556361,
                                             0.22926701,     1.02499966,   0.88402851,  -0.29178079,
                                             0.04250656,     0.86533058,   1.16110571,    1.5806361,
                                             1.774532,       1.23524584,   0.26825204,  -0.10625629,
                                             0.89645124,     0.90491519,   1.66935278,   3.84015239,
                                             4.80110814,     5.25514617,   4.58029441,   6.71044916,
                                             8.55404615,     8.92445758,   8.82633352,   9.17899751,
                                             10.10984143,   10.19528417,    9.2987422, 7.91781487 };

            Assert.Equal(expected_macd.Select(x => x.HasValue ? (double?)Math.Round(x.Value, 4) : null).ToArray(),
                         macd.Select(x => x.HasValue ? (double?)Math.Round(x.Value, 4) : null).ToArray());
            Assert.Equal(expected_signal, signal);
            Assert.Equal(expected_histogram, histogram);
        }
示例#15
0
        public Macd Macd(IEnumerable <Candle> candles, int fastPeriod = 12, int slowPeriod = 26, int signalPeriod = 9)
        {
            if (candles.Count() < (slowPeriod + signalPeriod - 1))
            {
                throw new Exception("Could not calculate MACD!");
            }



            var candleData = candles.ToList().OrderBy(c => c.Timestamp).ToList();

            var candleCount = candles.Count();

            var diList      = new decimal[candleCount];
            var emaFastList = new decimal?[candleCount];
            var emaSlowList = new decimal?[candleCount];
            var difList     = new decimal?[candleCount];
            var macdList    = new decimal?[candleCount];
            var oscList     = new decimal?[candleCount];


            #region DI

            for (int i = 0; i < candleCount; i++)
            {
                var candle = candleData[i];

                var high  = candle.High;
                var low   = candle.Low;
                var open  = candle.Open;
                var close = candle.Close;

                var di = (high + low + close * 2) / 4;
                diList[i] = di;
            }

            #endregion



            #region Ema Fast

            decimal firstEmaFast   = 0;
            decimal emaFastWarmSum = 0;

            for (int i = 0; i < fastPeriod; i++)
            {
                emaFastWarmSum += diList[i];
            }

            firstEmaFast = emaFastWarmSum / fastPeriod;
            emaFastList[fastPeriod - 1] = firstEmaFast;

            for (int i = fastPeriod; i < candleCount; i++)
            {
                var previous = emaFastList[i - 1];
                var emaFast  = (previous * (fastPeriod - 1) + diList[i] * 2) / (fastPeriod + 1);
                emaFastList[i] = emaFast;
            }

            #endregion


            #region Ema Slow

            decimal firstEmaSlow   = 0;
            decimal emaSlowWarmSum = 0;

            for (int i = 0; i < slowPeriod; i++)
            {
                emaSlowWarmSum += diList[i];
            }

            firstEmaSlow = emaSlowWarmSum / slowPeriod;
            emaSlowList[slowPeriod - 1] = firstEmaSlow;

            for (int i = slowPeriod; i < candleCount; i++)
            {
                var previous = emaSlowList[i - 1];
                var emaSlow  = (previous * (slowPeriod - 1) + diList[i] * 2) / (slowPeriod + 1);
                emaSlowList[i] = emaSlow;
            }

            #endregion


            #region DIF

            for (int i = slowPeriod - 1; i < candleCount; i++)
            {
                var dif = emaFastList[i] - emaSlowList[i];
                difList[i] = dif;
            }

            #endregion


            #region Macd

            decimal firstMacd  = 0;
            decimal difWarmSum = 0;

            for (int i = slowPeriod - 1; i < slowPeriod - 1 + signalPeriod; i++)
            {
                difWarmSum += (decimal)difList[i];
            }

            firstMacd = difWarmSum / signalPeriod;
            macdList[slowPeriod - 1 + signalPeriod - 1] = firstMacd;

            for (int i = slowPeriod - 1 + signalPeriod; i < candleCount; i++)
            {
                var previous = macdList[i - 1];
                var macd     = (previous * (signalPeriod - 1) + (decimal)difList[i] * 2) / (signalPeriod + 1);

                macdList[i] = macd;
            }

            #endregion


            #region

            for (int i = slowPeriod - 1 + signalPeriod - 1; i < candleCount; i++)
            {
                oscList[i] = difList[i] - macdList[i];
            }

            #endregion



            var macdItem = new Macd
            {
                DIF = difList.ToList(),
                DEM = macdList.ToList(),
                OSC = oscList.ToList()
            };


            return(macdItem);

            /*int outBegIdx, outNbElement;
             * double[] macdValues = new double[candles.Count()];
             * double[] signalValues = new double[candles.Count()];
             * double[] histValues = new double[candles.Count()];
             * var closes = candles.Select(x => Convert.ToDouble(x.Close)).ToArray();
             *
             * var macd = TicTacTec.TA.Library.Core.Macd(0, candles.Count() - 1, closes,
             *  fastPeriod, slowPeriod, signalPeriod, out outBegIdx, out outNbElement, macdValues, signalValues, histValues);
             *
             * if (macd == TicTacTec.TA.Library.Core.RetCode.Success)
             * {
             *  return new Macd()
             *  {
             *      Value = macdValues.ToList().FixIndicatorOrdering(outBegIdx, outNbElement),
             *      Signal = signalValues.ToList().FixIndicatorOrdering(outBegIdx, outNbElement),
             *      Hist = histValues.ToList().FixIndicatorOrdering(outBegIdx, outNbElement)
             *  };
             * }
             *
             * throw new Exception("Could not calculate MACD!"); */
        }
示例#16
0
        /// <summary>
        /// If the runnable has already been created, returns that object. If not then
        /// returns an new runnable object based on the name and the instrument.
        /// </summary>
        /// <param name="nameAndParameters">Name of the runnable</param>
        /// <returns>The runnable object</returns>
        public Runnable GetRunnable(string nameAndParameters)
        {
            Runnable requestedItem = null;

            // The name can have parameters to pass to the runnable construtor
            // and are separated by commas.
            // Ex: Rsi,11,3 would create the Rsi and pass the numbers to it in a
            // list. Its up to the indicator to do what it will with each number.
            string[] splitParams  = nameAndParameters.Split(',');
            string   runnableName = splitParams[0];

            string[] runnableParams = splitParams.Skip(1).Take(splitParams.Length - 1).ToArray();

            // See if the runnable is created already and return that object if it is.
            int key = nameAndParameters.GetHashCode();

            if (_createdItems.ContainsKey(key))
            {
                requestedItem = _createdItems[key];
            }
            else
            {
                switch (runnableName)
                {
                // Indicators.
                case "Bollinger":
                    requestedItem = new Bollinger(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "BressertDss":
                    requestedItem = new BressertDss(_tickerData, this, runnableParams);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "BressertTimingBands":
                    requestedItem = new BressertTimingBands(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "BearBeltHold":
                    requestedItem = new BearBeltHold(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "BearEngulfing":
                    requestedItem = new BearEngulfing(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "BearHarami":
                    requestedItem = new BearHarami(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "BearHaramiCross":
                    requestedItem = new BearHaramiCross(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "BullBeltHold":
                    requestedItem = new BullBeltHold(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "BullEngulfing":
                    requestedItem = new BullEngulfing(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "BullHarami":
                    requestedItem = new BullHarami(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "BullHaramiCross":
                    requestedItem = new BullHaramiCross(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "Cci14":
                    requestedItem = new Cci(_tickerData, this, 14);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "DarkCloudCover":
                    requestedItem = new DarkCloudCover(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "Doji":
                    requestedItem = new Doji(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "BearDoji":
                    requestedItem = new BearDoji(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "DownsideTasukiGap":
                    requestedItem = new DownsideTasukiGap(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "EaseOfMovement":
                    requestedItem = new EaseOfMovement(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "EveningStar":
                    requestedItem = new EveningStar(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "FallingThreeMethods":
                    requestedItem = new FallingThreeMethods(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "Hammer":
                    requestedItem = new Hammer(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "HangingMan":
                    requestedItem = new HangingMan(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "InvertedHammer":
                    requestedItem = new InvertedHammer(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "KeltnerChannel":
                    requestedItem = new KeltnerChannel(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "Macd":
                    requestedItem = new Macd(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "Momentum14":
                    requestedItem = new Momentum(_tickerData, this, 14);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "MorningStar":
                    requestedItem = new MorningStar(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "PiercingLine":
                    requestedItem = new PiercingLine(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "PriceOscillator":
                    requestedItem = new PriceOscillator(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "RisingThreeMethods":
                    requestedItem = new RisingThreeMethods(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "Rsi":
                    requestedItem = new Rsi(_tickerData, this, runnableParams);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "Rsi3m3":
                    requestedItem = new Rsi3m3(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "ShootingStar":
                    requestedItem = new ShootingStar(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "Sma":
                    requestedItem = new Sma(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "StickSandwitch":
                    requestedItem = new StickSandwitch(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "StochasticsFast":
                    requestedItem = new StochasticsFast(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "Stochastics":
                    requestedItem = new Stochastics(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "StochRsi":
                    requestedItem = new StochRsi(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "Trend":
                    requestedItem = new Trend(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "ThreeBlackCrows":
                    requestedItem = new ThreeBlackCrows(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "ThreeWhiteSoldiers":
                    requestedItem = new ThreeWhiteSoldiers(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "Trix":
                    requestedItem = new Trix(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "UpsideGapTwoCrows":
                    requestedItem = new UpsideGapTwoCrows(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "UpsideTasukiGap":
                    requestedItem = new UpsideTasukiGap(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "WilliamsR":
                    requestedItem = new WilliamsR(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "Dmi":
                    requestedItem = new Dmi(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "DtOscillator":
                    requestedItem = new DtOscillator(_tickerData, this, runnableParams);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "FibonacciZones":
                    requestedItem = new FibonacciZones(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "ElliotWaves":
                    requestedItem = new ElliotWaves(_tickerData, this);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                case "ZigZag":
                    requestedItem = new ZigZag(_tickerData, this, runnableParams);
                    Simulator.DataOutput.SaveIndicator((Indicator)requestedItem);
                    break;

                ///////////////////////////// Strategies ////////////////////////////

                case "BestOfRootStrategies":
                    requestedItem = new BestOfRootStrategies(_tickerData, this);
                    break;

                case "ComboStrategy":
                    requestedItem = new ComboStrategy(_tickerData, this);
                    break;

                case "BressertApproach":
                    requestedItem = new BressertApproach(_tickerData, this);
                    break;

                case "BressertComboStrategy":
                    requestedItem = new BressertComboStrategy(_tickerData, this);
                    break;

                case "FibonacciRsi3m3":
                    requestedItem = new FibonacciRsi3m3(_tickerData, this);
                    break;

                case "FibonacciDtOscillator":
                    requestedItem = new FibonacciDtOscillator(_tickerData, this);
                    break;

                case "ElliotWavesStrategy":
                    requestedItem = new ElliotWavesStrategy(_tickerData, this);
                    break;

                //
                // Bull
                //

                case "BullBollingerExtended":
                    requestedItem = new BullBollingerExtended(_tickerData, this);
                    break;

                case "BullBeltHoldFound":
                    requestedItem = new BullBeltHoldFound(_tickerData, this);
                    break;

                case "BullEngulfingFound":
                    requestedItem = new BullEngulfingFound(_tickerData, this);
                    break;

                case "BullHaramiFound":
                    requestedItem = new BullHaramiFound(_tickerData, this);
                    break;

                case "BullHaramiCrossFound":
                    requestedItem = new BullHaramiCrossFound(_tickerData, this);
                    break;

                case "BullCciCrossover":
                    requestedItem = new BullCciCrossover(_tickerData, this);
                    break;

                case "BullEaseOfMovement":
                    requestedItem = new BullEaseOfMovement(_tickerData, this);
                    break;

                case "BullDojiFound":
                    requestedItem = new BullDojiFound(_tickerData, this);
                    break;

                case "HammerFound":
                    requestedItem = new HammerFound(_tickerData, this);
                    break;

                case "BullKeltnerExtended":
                    requestedItem = new BullKeltnerExtended(_tickerData, this);
                    break;

                case "BullMacdCrossover":
                    requestedItem = new BullMacdCrossover(_tickerData, this);
                    break;

                case "BullMacdMomentum":
                    requestedItem = new BullMacdMomentum(_tickerData, this);
                    break;

                case "BullMomentumCrossover":
                    requestedItem = new BullMomentumCrossover(_tickerData, this);
                    break;

                case "MorningStarFound":
                    requestedItem = new MorningStarFound(_tickerData, this);
                    break;

                case "PiercingLineFound":
                    requestedItem = new PiercingLineFound(_tickerData, this);
                    break;

                case "RisingThreeMethodsFound":
                    requestedItem = new RisingThreeMethodsFound(_tickerData, this);
                    break;

                case "BullRsiCrossover":
                    requestedItem = new BullRsiCrossover(_tickerData, this);
                    break;

                case "BullSmaCrossover":
                    requestedItem = new BullSmaCrossover(_tickerData, this);
                    break;

                case "StickSandwitchFound":
                    requestedItem = new StickSandwitchFound(_tickerData, this);
                    break;

                case "BullStochasticsFastCrossover":
                    requestedItem = new BullStochasticsFastCrossover(_tickerData, this);
                    break;

                case "BullStochasticsCrossover":
                    requestedItem = new BullStochasticsCrossover(_tickerData, this);
                    break;

                case "BullStochRsiCrossover":
                    requestedItem = new BullStochRsiCrossover(_tickerData, this);
                    break;

                case "ThreeWhiteSoldiersFound":
                    requestedItem = new ThreeWhiteSoldiersFound(_tickerData, this);
                    break;

                case "BullTrendStart":
                    requestedItem = new BullTrendStart(_tickerData, this);
                    break;

                case "BullTrixSignalCrossover":
                    requestedItem = new BullTrixSignalCrossover(_tickerData, this);
                    break;

                case "BullTrixZeroCrossover":
                    requestedItem = new BullTrixZeroCrossover(_tickerData, this);
                    break;

                case "UpsideTasukiGapFound":
                    requestedItem = new UpsideTasukiGapFound(_tickerData, this);
                    break;

                case "BullWilliamsRCrossover":
                    requestedItem = new BullWilliamsRCrossover(_tickerData, this);
                    break;

                case "BullPriceOscillator":
                    requestedItem = new BullPriceOscillator(_tickerData, this);
                    break;

                case "BullDmi":
                    requestedItem = new BullDmi(_tickerData, this);
                    break;

                case "BullBressertDss":
                    requestedItem = new BullBressertDss(_tickerData, this, runnableParams);
                    break;

                case "BullRsi3m3":
                    requestedItem = new BullRsi3m3(_tickerData, this);
                    break;

                case "BullDtOscillator":
                    requestedItem = new BullDtOscillator(_tickerData, this);
                    break;

                //////////// Predicted bull strategies ///////////

                case "BullCciCrossoverPredicted":
                    requestedItem = new BullCciCrossoverPredicted(_tickerData, this);
                    break;

                case "BullDmiPredicted":
                    requestedItem = new BullDmiPredicted(_tickerData, this);
                    break;

                case "BullEaseOfMovementPredicted":
                    requestedItem = new BullEaseOfMovementPredicted(_tickerData, this);
                    break;

                case "BullKeltnerExtendedPredicted":
                    requestedItem = new BullKeltnerExtendedPredicted(_tickerData, this);
                    break;

                case "BullMacdCrossoverPredicted":
                    requestedItem = new BullMacdCrossoverPredicted(_tickerData, this);
                    break;

                case "BullMomentumCrossoverPredicted":
                    requestedItem = new BullMomentumCrossoverPredicted(_tickerData, this);
                    break;

                case "BullPriceOscillatorPredicted":
                    requestedItem = new BullPriceOscillatorPredicted(_tickerData, this);
                    break;

                case "BullRsiCrossoverPredicted":
                    requestedItem = new BullRsiCrossoverPredicted(_tickerData, this);
                    break;

                case "BullSmaCrossoverPredicted":
                    requestedItem = new BullSmaCrossoverPredicted(_tickerData, this);
                    break;

                case "BullStochasticsCrossoverPredicted":
                    requestedItem = new BullStochasticsCrossoverPredicted(_tickerData, this);
                    break;

                case "BullStochasticsFastCrossoverPredicted":
                    requestedItem = new BullStochasticsFastCrossoverPredicted(_tickerData, this);
                    break;

                case "BullStochRsiCrossoverPredicted":
                    requestedItem = new BullStochRsiCrossoverPredicted(_tickerData, this);
                    break;

                case "BullTrixSignalCrossoverPredicted":
                    requestedItem = new BullTrixSignalCrossoverPredicted(_tickerData, this);
                    break;

                case "BullTrixZeroCrossoverPredicted":
                    requestedItem = new BullTrixZeroCrossoverPredicted(_tickerData, this);
                    break;

                case "BullWilliamsRCrossoverPredicted":
                    requestedItem = new BullWilliamsRCrossoverPredicted(_tickerData, this);
                    break;


                //
                // Bear
                //

                case "BearBollingerExtended":
                    requestedItem = new BearBollingerExtended(_tickerData, this);
                    break;

                case "BearCciCrossover":
                    requestedItem = new BearCciCrossover(_tickerData, this);
                    break;

                case "BearEaseOfMovement":
                    requestedItem = new BearEaseOfMovement(_tickerData, this);
                    break;

                case "BearDojiFound":
                    requestedItem = new BearDojiFound(_tickerData, this);
                    break;

                case "BearKeltnerExtended":
                    requestedItem = new BearKeltnerExtended(_tickerData, this);
                    break;

                case "BearMacdMomentum":
                    requestedItem = new BearMacdMomentum(_tickerData, this);
                    break;

                case "BearMacdCrossover":
                    requestedItem = new BearMacdCrossover(_tickerData, this);
                    break;

                case "BearMomentumCrossover":
                    requestedItem = new BearMomentumCrossover(_tickerData, this);
                    break;

                case "BearRsiCrossover":
                    requestedItem = new BearRsiCrossover(_tickerData, this);
                    break;

                case "BearSmaCrossover":
                    requestedItem = new BearSmaCrossover(_tickerData, this);
                    break;

                case "BearStochasticsCrossover":
                    requestedItem = new BearStochasticsCrossover(_tickerData, this);
                    break;

                case "BearStochasticsFastCrossover":
                    requestedItem = new BearStochasticsFastCrossover(_tickerData, this);
                    break;

                case "BearStochRsiCrossover":
                    requestedItem = new BearStochRsiCrossover(_tickerData, this);
                    break;

                case "BearTrendStart":
                    requestedItem = new BearTrendStart(_tickerData, this);
                    break;

                case "BearTrixSignalCrossover":
                    requestedItem = new BearTrixSignalCrossover(_tickerData, this);
                    break;

                case "BearTrixZeroCrossover":
                    requestedItem = new BearTrixZeroCrossover(_tickerData, this);
                    break;

                case "BearWilliamsRCrossover":
                    requestedItem = new BearWilliamsRCrossover(_tickerData, this);
                    break;

                case "BearBeltHoldFound":
                    requestedItem = new BearBeltHoldFound(_tickerData, this);
                    break;

                case "BearEngulfingFound":
                    requestedItem = new BearEngulfingFound(_tickerData, this);
                    break;

                case "BearHaramiFound":
                    requestedItem = new BearHaramiFound(_tickerData, this);
                    break;

                case "BearHaramiCrossFound":
                    requestedItem = new BearHaramiCrossFound(_tickerData, this);
                    break;

                case "DarkCloudCoverFound":
                    requestedItem = new DarkCloudCoverFound(_tickerData, this);
                    break;

                case "DownsideTasukiGapFound":
                    requestedItem = new DownsideTasukiGapFound(_tickerData, this);
                    break;

                case "EveningStarFound":
                    requestedItem = new EveningStarFound(_tickerData, this);
                    break;

                case "FallingThreeMethodsFound":
                    requestedItem = new FallingThreeMethodsFound(_tickerData, this);
                    break;

                case "HangingManFound":
                    requestedItem = new HangingManFound(_tickerData, this);
                    break;

                case "InvertedHammerFound":
                    requestedItem = new InvertedHammerFound(_tickerData, this);
                    break;

                case "ShootingStarFound":
                    requestedItem = new ShootingStarFound(_tickerData, this);
                    break;

                case "ThreeBlackCrowsFound":
                    requestedItem = new ThreeBlackCrowsFound(_tickerData, this);
                    break;

                case "UpsideGapTwoCrowsFound":
                    requestedItem = new UpsideGapTwoCrowsFound(_tickerData, this);
                    break;

                case "BearPriceOscillator":
                    requestedItem = new BearPriceOscillator(_tickerData, this);
                    break;

                case "BearDmi":
                    requestedItem = new BearDmi(_tickerData, this);
                    break;

                case "BearBressertDss":
                    requestedItem = new BearBressertDss(_tickerData, this, runnableParams);
                    break;

                case "BearRsi3m3":
                    requestedItem = new BearRsi3m3(_tickerData, this);
                    break;

                case "BearDtOscillator":
                    requestedItem = new BearDtOscillator(_tickerData, this);
                    break;

                //////////// Predicted bear strategies ///////////

                case "BearCciCrossoverPredicted":
                    requestedItem = new BearCciCrossoverPredicted(_tickerData, this);
                    break;

                case "BearDmiPredicted":
                    requestedItem = new BearDmiPredicted(_tickerData, this);
                    break;

                case "BearEaseOfMovementPredicted":
                    requestedItem = new BearEaseOfMovementPredicted(_tickerData, this);
                    break;

                case "BearKeltnerExtendedPredicted":
                    requestedItem = new BearKeltnerExtendedPredicted(_tickerData, this);
                    break;

                case "BearMacdCrossoverPredicted":
                    requestedItem = new BearMacdCrossoverPredicted(_tickerData, this);
                    break;

                case "BearMomentumCrossoverPredicted":
                    requestedItem = new BearMomentumCrossoverPredicted(_tickerData, this);
                    break;

                case "BearPriceOscillatorPredicted":
                    requestedItem = new BearPriceOscillatorPredicted(_tickerData, this);
                    break;

                case "BearRsiCrossoverPredicted":
                    requestedItem = new BearRsiCrossoverPredicted(_tickerData, this);
                    break;

                case "BearSmaCrossoverPredicted":
                    requestedItem = new BearSmaCrossoverPredicted(_tickerData, this);
                    break;

                case "BearStochasticsCrossoverPredicted":
                    requestedItem = new BearStochasticsCrossoverPredicted(_tickerData, this);
                    break;

                case "BearStochasticsFastCrossoverPredicted":
                    requestedItem = new BearStochasticsFastCrossoverPredicted(_tickerData, this);
                    break;

                case "BearStochRsiCrossoverPredicted":
                    requestedItem = new BearStochRsiCrossoverPredicted(_tickerData, this);
                    break;

                case "BearTrixSignalCrossoverPredicted":
                    requestedItem = new BearTrixSignalCrossoverPredicted(_tickerData, this);
                    break;

                case "BearTrixZeroCrossoverPredicted":
                    requestedItem = new BearTrixZeroCrossoverPredicted(_tickerData, this);
                    break;

                case "BearWilliamsRCrossoverPredicted":
                    requestedItem = new BearWilliamsRCrossoverPredicted(_tickerData, this);
                    break;

                default:
                    throw new Exception(nameAndParameters + " doesn't exist");
                }

                _createdItems[key] = requestedItem;
            }

            return(requestedItem);
        }
 public void Reset()
 {
     Macd.Reset();
     SignalMa.Reset();
 }