public IMoveAnalyzerResult Execute(IMoveManager moveMgr, IMove newMove)
        {
            IBarDatum barData = newMove.Start;

            List <ProspectiveIR> gamma = GammaAnalyzer.GetValues(false, barData); //gamma

            var irList = moveMgr.Highs
                         .Where(b => b.High < barData.Low)
                         .Select(h => h.High)
                         .Distinct()
                         .OrderBy(v => v)
                         .ToList();

            var irLowPoints = moveMgr.Lows
                              .Where(b => b.Low < barData.Low)
                              .Select(l => l.Low)
                              .Distinct()
                              .OrderBy(v => v)
                              .ToList();


            irList.AddRange(irLowPoints.Where(v => !irList.Contains(v)).ToList());

            var tempList = new List <double>();

            if (barData.Low > moveMgr.PreviousMove.Start.High)
            {
                List <double> APrevious = AFromBar(moveMgr.PreviousMove.Start);

                foreach (var a in APrevious)
                {
                    var possibles = irList.Where(v => Math.Abs(a - v) < 5).ToList();

                    tempList.AddRange(possibles);
                }
            }
            else
            {
                tempList = irList;
            }

            List <ProspectiveIR> resultList = new List <ProspectiveIR>();

            foreach (var g in gamma)
            {
                var possible = tempList.Where(t => Math.Abs(g.Price - t) < 5).ToList().Min();

                resultList.Add(new ProspectiveIR(g.Degrees, possible));
            }

            MoveAnalyzerResult result = new MoveAnalyzerResult(barData, resultList);

            return(result);
        }
        public IMoveAnalyzerResult Execute(IMoveManager moveMgr, IMove newMove)
        {
            // this is for a long break:
            // if start is below A, then group A that matches a previous IR
            // otherwise group A from previous start. Previous start will the the high of preceding downtrend
            // lets see what this looks like without that wrinkle

            //            List<double> AFromStart = AFromBar(newMove.Start);

            IBarDatum barData = newMove.Start;

            List <ProspectiveIR> gamma = GammaAnalyzer.GetValues(true, barData); //gamma

            // now get union of Highs and lows from MoveMgr
            var irList = moveMgr.Highs
                         .Where(b => b.High > barData.High)
                         .Select(h => h.High)
                         .Distinct()
                         .OrderBy(v => v)
                         .ToList();

            var irLowPoints = moveMgr.Lows
                              .Where(b => b.Low > barData.High)
                              .Select(l => l.Low)
                              .Distinct()
                              .OrderBy(v => v)
                              .ToList();

            irList.AddRange(irLowPoints.Where(v => !irList.Contains(v)).ToList());

            var tempList = new List <double>();

            if (barData.High < moveMgr.PreviousMove.Start.Low)
            {
                List <double> APrevious = AFromBar(moveMgr.PreviousMove.Start);

                foreach (var a in APrevious)
                {
                    var possibles = irList.Where(v => Math.Abs(a - v) < 5).ToList();

                    tempList.AddRange(possibles);
                }
            }
            else
            {
                tempList = irList;
            }

            List <ProspectiveIR> resultList = new List <ProspectiveIR>();

            foreach (var g in gamma)
            {
                var possible = tempList.Where(t => Math.Abs(g.Price - t) < 5).ToList().Min();

                resultList.Add(new ProspectiveIR(g.Degrees, possible));
            }

            MoveAnalyzerResult result = new MoveAnalyzerResult(barData, resultList);

            return(result);
        }