Beispiel #1
0
        public void ResetsProperly()
        {
            var cci = new CommodityChannelIndex(2);

            cci.Update(DateTime.Today, new TradeBarValue {
                Open   = 3d,
                High   = 7d,
                Low    = 2d,
                Close  = 5d,
                Volume = 10
            });
            Assert.IsFalse(cci.IsReady);
            cci.Update(DateTime.Today.AddSeconds(1), new TradeBarValue {
                Open   = 3d,
                High   = 7d,
                Low    = 2d,
                Close  = 5d,
                Volume = 10
            });
            Assert.IsTrue(cci.IsReady);

            cci.Reset();
            TestHelper.AssertIndicatorIsInDefaultState(cci);
            TestHelper.AssertIndicatorIsInDefaultState(cci.TypicalPriceAverage);
            TestHelper.AssertIndicatorIsInDefaultState(cci.TypicalPriceMeanDeviation);
        }
        public void ResetsProperly()
        {
            var cci = new CommodityChannelIndex(2);

            cci.Update(new TradeBar
            {
                Ticker   = Props.TickerSymbol,
                Occured  = DateTime.Today,
                Open     = 3m,
                High     = 7m,
                Low      = 2m,
                Close    = 5m,
                Volume   = 10,
                TimeZone = TimeZone.Utc
            });
            Assert.False(cci.IsReady);
            cci.Update(new TradeBar
            {
                Ticker   = Props.TickerSymbol,
                Occured  = DateTime.Today.AddSeconds(1),
                Open     = 3m,
                High     = 7m,
                Low      = 2m,
                Close    = 5m,
                Volume   = 10,
                TimeZone = TimeZone.Utc
            });
            Assert.True(cci.IsReady);

            cci.Reset();
            TestHelper.AssertIndicatorIsInDefaultState(cci);
            TestHelper.AssertIndicatorIsInDefaultState(cci.TypicalPriceAverage);
            TestHelper.AssertIndicatorIsInDefaultState(cci.TypicalPriceMeanDeviation);
        }
        public override void ResetsProperly()
        {
            var cci = new CommodityChannelIndex(2);

            cci.Update(new TradeBar
            {
                Symbol = Symbols.SPY,
                Time   = DateTime.Today,
                Open   = 3m,
                High   = 7m,
                Low    = 2m,
                Close  = 5m,
                Volume = 10
            });
            Assert.IsFalse(cci.IsReady);
            cci.Update(new TradeBar
            {
                Symbol = Symbols.SPY,
                Time   = DateTime.Today.AddSeconds(1),
                Open   = 3m,
                High   = 7m,
                Low    = 2m,
                Close  = 5m,
                Volume = 10
            });
            Assert.IsTrue(cci.IsReady);

            cci.Reset();
            TestHelper.AssertIndicatorIsInDefaultState(cci);
            TestHelper.AssertIndicatorIsInDefaultState(cci.TypicalPriceAverage);
            TestHelper.AssertIndicatorIsInDefaultState(cci.TypicalPriceMeanDeviation);
        }