public void bollingerBandsMiddleUsingSMA()
        {
            SMAIndicator sma = new SMAIndicator(new ClosePriceIndicator(data), 3);
            BollingerBandsMiddleIndicator bbmSMA = new BollingerBandsMiddleIndicator(sma);

            for (int i = 0; i < data.GetBarCount(); i++)
            {
                Assert.AreEqual(sma.GetValue(i), bbmSMA.GetValue(i));
            }
        }
        public void BollingerBandsMiddleUsingSma()
        {
            var sma    = new SmaIndicator(new ClosePriceIndicator(_data), 3);
            var bbmSma = new BollingerBandsMiddleIndicator(sma);

            for (var i = 0; i < _data.TickCount; i++)
            {
                Assert.AreEqual(sma.GetValue(i), bbmSma.GetValue(i));
            }
        }
Beispiel #3
0
 protected override Decimal Calculate(int index)
 {
     return(_bbu.GetValue(index).Minus(_bbl.GetValue(index)).DividedBy(_bbm.GetValue(index)).MultipliedBy(Decimal.Hundred));
 }
 protected override Decimal Calculate(int index)
 {
     return(_bbm.GetValue(index).Plus(_indicator.GetValue(index).MultipliedBy(_k)));
 }