コード例 #1
0
        public void ConstantIndicators()
        {
            var positiveInd = new AbsoluteIndicator(new ConstantIndicator <Decimal>(Decimal.ValueOf(1337)));
            var zeroInd     = new AbsoluteIndicator(new ConstantIndicator <Decimal>(Decimal.Zero));
            var negativeInd = new AbsoluteIndicator(new ConstantIndicator <Decimal>(Decimal.ValueOf(-42.42)));

            for (var i = 0; i < 10; i++)
            {
                TaTestsUtils.AssertDecimalEquals(positiveInd.GetValue(i), 1337);
                TaTestsUtils.AssertDecimalEquals(zeroInd.GetValue(i), 0);
                TaTestsUtils.AssertDecimalEquals(negativeInd.GetValue(i), 42.42);
            }
        }
コード例 #2
0
        public void constantIndicators()
        {
            AbsoluteIndicator positiveInd = new AbsoluteIndicator(new ConstantIndicator <decimal>(1337M));
            AbsoluteIndicator zeroInd     = new AbsoluteIndicator(new ConstantIndicator <decimal>(Decimals.ZERO));
            AbsoluteIndicator negativeInd = new AbsoluteIndicator(new ConstantIndicator <decimal>(-42.42M));

            for (int i = 0; i < 10; i++)
            {
                Assert.AreEqual(positiveInd.GetValue(i), 1337M);
                Assert.AreEqual(zeroInd.GetValue(i), 0M);
                Assert.AreEqual(negativeInd.GetValue(i), 42.42M);
            }
        }
コード例 #3
0
        public TSIIndicator(IIndicator <decimal> indicator, ITimeSeries timeSeries) : base(timeSeries)
        {
            _indicator = indicator;

            // Double Smoothed price change
            _differenceIndicator                = new DifferenceIndicator(indicator, new PreviousValueIndicator(indicator));
            _ema25OfPriceChangeIndicator        = new EMAIndicator(_differenceIndicator, 25);
            _ema13OfEma25OfPriceChangeIndicator = new EMAIndicator(_ema25OfPriceChangeIndicator, 13);

            // Double Smoothed Absolute price change
            _absolutePriceChangeIndicator               = new AbsoluteIndicator(_differenceIndicator);
            _ema25OfAbsolutePriceChangeIndicator        = new EMAIndicator(_absolutePriceChangeIndicator, 25);
            _ema13OfEma25OfAbsolutePriceChangeIndicator = new EMAIndicator(_ema25OfAbsolutePriceChangeIndicator, 13);
        }