/// <summary>
 /// Initializes a new instance of the <see cref="AccumulationDistributionOscillator"/> class using the specified parameters
 /// </summary> 
 /// <param name="name">The name of this indicator</param>
 /// <param name="fastPeriod">The fast moving average period</param>
 /// <param name="slowPeriod">The slow moving average period</param>
 public AccumulationDistributionOscillator(string name, int fastPeriod, int slowPeriod)
     : base(name)
 {
     _period = Math.Max(fastPeriod, slowPeriod);
     _ad = new AccumulationDistribution(name + "_AD");
     _emaFast = new ExponentialMovingAverage(name + "_Fast", fastPeriod);
     _emaSlow = new ExponentialMovingAverage(name + "_Slow", slowPeriod);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AccumulationDistributionOscillator"/> class using the specified parameters
 /// </summary>
 /// <param name="name">The name of this indicator</param>
 /// <param name="fastPeriod">The fast moving average period</param>
 /// <param name="slowPeriod">The slow moving average period</param>
 public AccumulationDistributionOscillator(string name, int fastPeriod, int slowPeriod)
     : base(name)
 {
     _period  = Math.Max(fastPeriod, slowPeriod);
     _ad      = new AccumulationDistribution(name + "_AD");
     _emaFast = new ExponentialMovingAverage(name + "_Fast", fastPeriod);
     _emaSlow = new ExponentialMovingAverage(name + "_Slow", slowPeriod);
 }
        public void ComparesAgainstExternalDataAfterReset()
        {
            var ad = new AccumulationDistribution("AD");

            RunTestIndicator(ad);
            ad.Reset();
            RunTestIndicator(ad);
        }
        public void ResetsProperly()
        {
            var ad = new AccumulationDistribution("AD");
            foreach (var data in TestHelper.GetTradeBarStream("spy_ad.txt", false))
            {
                ad.Update(data);
            }

            Assert.IsTrue(ad.IsReady);

            ad.Reset();

            TestHelper.AssertIndicatorIsInDefaultState(ad);
        }
        public void ComparesAgainstExternalData()
        {
            var ad = new AccumulationDistribution("AD");

            TestHelper.TestIndicator(ad, "spy_ad.txt", "AD", (ind, expected) => Assert.AreEqual(expected, (double)ind.Current.Value, 1e-3));
        }
 private static void RunTestIndicator(AccumulationDistribution ad)
 {
     TestHelper.TestIndicator(ad, "spy_ad.txt", "AD", (ind, expected) => Assert.AreEqual(expected, (double)ind.Current.Value, 1e-3));
 }
        public void ResetsProperly()
        {
            var ad = new AccumulationDistribution("AD");

            TestHelper.TestIndicatorReset(ad, "spy_ad.txt");
        }