Ejemplo n.º 1
0
        private SignalStatus MacdStatus(Symbol symbol)
        {
            var status = new SignalStatus();

            if (!_macdHistograms.ContainsKey(symbol) ||
                !_macdHistograms[symbol].IsReady)
            {
                return(status);
            }

            var histograms = _macdHistograms[symbol].Select(x => x.Value).ToList();

            var daysSinceInSellRange = histograms.FindIndex(x => x < 0);

            if (histograms[0] > 0 && daysSinceInSellRange > 0)
            {
                status.Direction      = InsightDirection.Up;
                status.DaysPastSignal = daysSinceInSellRange - 1;
            }

            var daysSinceInBuyRange = histograms.FindIndex(x => x > 0);

            if (histograms[0] < 0 && daysSinceInBuyRange > 0)
            {
                status.Direction      = InsightDirection.Down;
                status.DaysPastSignal = daysSinceInBuyRange - 1;
            }

            return(status);
        }
Ejemplo n.º 2
0
        private SignalStatus StoStatus(Symbol symbol)
        {
            var status = new SignalStatus();

            if (!_stos.ContainsKey(symbol) ||
                !_stos[symbol].IsReady)
            {
                return(status);
            }

            var stos = _stos[symbol].Select(x => x.Value).ToList();

            var daysSinceOutBuyRange = stos.FindIndex(x => x > StoBuyThreshold) - 1;

            if (stos[0] <= StoBuyThreshold && daysSinceOutBuyRange > 0)
            {
                status.DaysPastSignal = daysSinceOutBuyRange;
                status.Direction      = InsightDirection.Up;
            }

            var daysSinceOutSellRange = stos.FindIndex(x => x < StoSellThreshold) - 1;

            if (stos[0] >= StoSellThreshold && daysSinceOutSellRange > 0)
            {
                status.DaysPastSignal = daysSinceOutSellRange;
                status.Direction      = InsightDirection.Down;
            }

            return(status);
        }