Example #1
0
        public void BuildComparison(StockData stock, List <string> combination, string finishedList = "")
        {
            if (combination.Count != 0)
            {
                string current = combination[combination.Count - 1];
                combination.RemoveAt(combination.Count - 1);

                switch (current)
                {
                case ("RSI"):
                    foreach (var rsi in RSI)
                    {
                        if (stock.RSI <= rsi)
                        {
                            BuildComparison(stock, combination, finishedList + $"RSI{rsi}/");
                        }
                    }
                    break;

                case ("MOM"):
                    foreach (var mom in MOM)
                    {
                        if (stock.MOM <= mom)
                        {
                            BuildComparison(stock, combination, finishedList + $"MOM{mom}/");
                        }
                    }
                    break;

                case ("MACD"):
                    foreach (var macd in MACD)
                    {
                        if (stock.MACD <= macd)
                        {
                            BuildComparison(stock, combination, finishedList + $"MACD{macd}/");
                        }
                    }
                    break;

                case ("BOP"):
                    foreach (var bop in BOP)
                    {
                        if (stock.BOP <= bop)
                        {
                            BuildComparison(stock, combination, finishedList + $"BOP{bop}/");
                        }
                    }
                    break;

                case ("BBANDS"):
                    foreach (var bband in BBANDS)
                    {
                        if (stock.BBANDS <= bband)
                        {
                            BuildComparison(stock, combination, finishedList + $"BBANDS{bband}/");
                        }
                    }
                    break;

                case ("ADX"):
                    foreach (var adx in ADX)
                    {
                        if (stock.ADX <= adx)
                        {
                            BuildComparison(stock, combination, finishedList + $"ADX{adx}/");
                        }
                    }
                    break;

                default:
                    break;
                }
            }
            else
            {
                if (stock.Gain > minimumGain)
                {
                    AddToSucess(stock, finishedList, 1);
                }
                else
                {
                    AddToSucess(stock, finishedList, 0);
                }
            }
        }