public override double Update(StockAnalysis.Share.Bar bar)
        {
            double highest = _highest.Update(bar.HighestPrice);
            double lowest  = _lowest.Update(bar.LowestPrice);

            double rsv = (bar.ClosePrice - lowest) / (highest - lowest) * 100;

            return(100.0 - rsv);
        }
Esempio n. 2
0
        public override double[] Update(StockAnalysis.Share.Bar bar)
        {
            double lowestPrice  = _lowest.Update(bar.LowestPrice);
            double highestPrice = _highest.Update(bar.HighestPrice);

            double rsv = (bar.ClosePrice - lowestPrice) / (highestPrice - lowestPrice) * 100.0;

            double k = rsv;
            double d = ((_kDecay - 1) * _prevD + k) / _kDecay;
            double j = _jCoeff * d - (_jCoeff - 1) * k;

            // update status;
            _prevD = d;

            return(new double[3] {
                k, d, j
            });
        }