예제 #1
0
 public void IndicatorShouldRetrieveTickMaxPrice()
 {
     for (var i = 0; i < 10; i++)
     {
         var tick         = _timeSeries.GetTick(i);
         var typicalPrice = tick.MaxPrice.Plus(tick.MinPrice).Plus(tick.ClosePrice).DividedBy(Decimal.Three);
         Assert.AreEqual(typicalPrice, _typicalPriceIndicator.GetValue(i));
     }
 }
예제 #2
0
 public void indicatorShouldRetrieveBarMaxPrice()
 {
     for (int i = 0; i < 10; i++)
     {
         IBar    bar          = timeSeries.GetBar(i);
         decimal typicalPrice = bar.MaxPrice.Plus(bar.MinPrice).Plus(bar.ClosePrice)
                                .DividedBy(Decimals.THREE);
         Assert.AreEqual(typicalPrice, typicalPriceIndicator.GetValue(i));
     }
 }
예제 #3
0
        protected override Decimal Calculate(int index)
        {
            var typicalPrice    = _typicalPriceInd.GetValue(index);
            var typicalPriceAvg = _smaInd.GetValue(index);
            var meanDeviation   = _meanDeviationInd.GetValue(index);

            if (meanDeviation.IsZero)
            {
                return(Decimal.Zero);
            }
            return((typicalPrice.Minus(typicalPriceAvg)).DividedBy(meanDeviation.MultipliedBy(Factor)));
        }
예제 #4
0
        protected override decimal Calculate(int index)
        {
            decimal typicalPrice    = _typicalPriceInd.GetValue(index);
            decimal typicalPriceAvg = _smaInd.GetValue(index);
            decimal meanDeviation   = _meanDeviationInd.GetValue(index);

            if (meanDeviation.IsZero())
            {
                return(Decimals.Zero);
            }
            return((typicalPrice.Minus(typicalPriceAvg)).DividedBy(meanDeviation.MultipliedBy(FACTOR)));
        }