public void getValue()
        {
            CloseLocationValueIndicator clv = new CloseLocationValueIndicator(series);

            Assert.AreEqual(clv.GetValue(0), 0.6M);
            Assert.AreEqual(clv.GetValue(1), 0.5M);
            Assert.AreEqual(clv.GetValue(2), 0);
            Assert.AreEqual(clv.GetValue(3), -1M / 7);
            Assert.AreEqual(clv.GetValue(4), 1M);
        }
예제 #2
0
        public void GetValue()
        {
            var clv = new CloseLocationValueIndicator(_series);

            TaTestsUtils.AssertDecimalEquals(clv.GetValue(0), 0.6);
            TaTestsUtils.AssertDecimalEquals(clv.GetValue(1), 0.5);
            TaTestsUtils.AssertDecimalEquals(clv.GetValue(2), 0);
            TaTestsUtils.AssertDecimalEquals(clv.GetValue(3), -1d / 7);
            TaTestsUtils.AssertDecimalEquals(clv.GetValue(4), 1);
        }
        protected override decimal Calculate(int index)
        {
            if (index == 0)
            {
                return(Decimals.Zero);
            }

            // Calculating the money flow multiplier
            decimal moneyFlowMultiplier = _clvIndicator.GetValue(index);

            // Calculating the money flow volume
            decimal moneyFlowVolume = moneyFlowMultiplier.MultipliedBy(_series.GetBar(index).Volume);

            return(moneyFlowVolume.Plus(GetValue(index - 1)));
        }
 /// <param name="index"> the tick index </param>
 /// <returns> the money flow volume for the i-th period/tick </returns>
 private Decimal GetMoneyFlowVolume(int index)
 {
     return(_clvIndicator.GetValue(index).MultipliedBy(_series.GetTick(index).Volume));
 }