Exemple #1
0
        public void setUp()
        {
            IIndicator <decimal> indicator = new FixeddecimalIndicator(50, 70, 80, 90, 99, 60, 30, 20, 10, 0);

            rulePositiveSlope = new InSlopeRule(indicator, 20M, 30);
            ruleNegativeSlope = new InSlopeRule(indicator, -40M, -20);
        }
        public void getValueOnFixeddecimalIndicator()
        {
            FixeddecimalIndicator fixeddecimalIndicator = new FixeddecimalIndicator(13.37M, 42, -17);

            Assert.AreEqual(fixeddecimalIndicator.GetValue(0), 13.37M);
            Assert.AreEqual(fixeddecimalIndicator.GetValue(1), 42M);
            Assert.AreEqual(fixeddecimalIndicator.GetValue(2), -17M);

            fixeddecimalIndicator = new FixeddecimalIndicator(3.0M, -123.456M, 0M);
            Assert.AreEqual(fixeddecimalIndicator.GetValue(0), 3M);
            Assert.AreEqual(fixeddecimalIndicator.GetValue(1), -123.456M);
            Assert.AreEqual(fixeddecimalIndicator.GetValue(2), 0.0M);
        }
Exemple #3
0
        public void TestWith2Indicators()
        {
            var fixedValueIndicator1 = new FixeddecimalIndicator(100, 200, 300, 400, 500);
            var fixedValueIndicator2 = new FixeddecimalIndicator(10, 20, 30, 40, 50);

            var indicator = new MinusIndicator(fixedValueIndicator1, fixedValueIndicator2);

            Assert.AreEqual(90, indicator.GetValue(0));
            Assert.AreEqual(180, indicator.GetValue(1));
            Assert.AreEqual(270, indicator.GetValue(2));
            Assert.AreEqual(360, indicator.GetValue(3));
            Assert.AreEqual(450, indicator.GetValue(4));
        }
        public void TestWithIndicatorsInput()
        {
            var fixedValueIndicator1 = new FixeddecimalIndicator(10, 20, 30, 40, 50);
            var fixedValueIndicator2 = new FixeddecimalIndicator(100, 200, 300, 400, 500);

            var indicator = new AverageIndicator(fixedValueIndicator1, fixedValueIndicator2);

            Assert.AreEqual(55, indicator.GetValue(0));
            Assert.AreEqual(110, indicator.GetValue(1));
            Assert.AreEqual(165, indicator.GetValue(2));
            Assert.AreEqual(220, indicator.GetValue(3));
            Assert.AreEqual(275, indicator.GetValue(4));
        }
        public void CalculateInverseValues()
        {
            var fixedValueIndicator = new FixeddecimalIndicator(100, 200, 300, -400, -500, 600);

            var indicator = new InverseIndicator(fixedValueIndicator);

            Assert.AreEqual(-100, indicator.GetValue(0));
            Assert.AreEqual(-200, indicator.GetValue(1));
            Assert.AreEqual(-300, indicator.GetValue(2));
            Assert.AreEqual(400, indicator.GetValue(3));
            Assert.AreEqual(500, indicator.GetValue(4));
            Assert.AreEqual(-600, indicator.GetValue(5));
        }
Exemple #6
0
        public void TestWith3Indicators()
        {
            var fixedValueIndicator1 = new FixeddecimalIndicator(100, 200, 300, 400, 500);
            var fixedValueIndicator2 = new FixeddecimalIndicator(10, 20, 30, 40, 50);
            var fixedValueIndicator3 = new FixeddecimalIndicator(1000, 120, 530, 140, -50);

            var indicator = new MinusIndicator(fixedValueIndicator1, fixedValueIndicator2, fixedValueIndicator3);

            Assert.AreEqual(-910, indicator.GetValue(0));
            Assert.AreEqual(60, indicator.GetValue(1));
            Assert.AreEqual(-260, indicator.GetValue(2));
            Assert.AreEqual(220, indicator.GetValue(3));
            Assert.AreEqual(500, indicator.GetValue(4));
        }
        public void ShouldLimitTheMaximumResult()
        {
            var maximumValue        = 2;
            var fixedValueIndicator = new FixeddecimalIndicator(-1, 0, 1, 2, 3, 2, 1);

            var indicator = new MaximumValueIndicator(fixedValueIndicator, maximumValue);

            Assert.AreEqual(-1, indicator.GetValue(0));
            Assert.AreEqual(0, indicator.GetValue(1));
            Assert.AreEqual(1, indicator.GetValue(2));
            Assert.AreEqual(2, indicator.GetValue(3));
            Assert.AreEqual(2, indicator.GetValue(4));
            Assert.AreEqual(2, indicator.GetValue(5));
            Assert.AreEqual(1, indicator.GetValue(6));
        }
Exemple #8
0
        public void ShouldLimitTheMinimumResult()
        {
            var minimumValue        = 1;
            var fixedValueIndicator = new FixeddecimalIndicator(-1, 0, 1, 2, 3, 2, 1, 4);

            var indicator = new MinimumValueIndicator(fixedValueIndicator, minimumValue);

            Assert.AreEqual(1, indicator.GetValue(0));
            Assert.AreEqual(1, indicator.GetValue(1));
            Assert.AreEqual(1, indicator.GetValue(2));
            Assert.AreEqual(2, indicator.GetValue(3));
            Assert.AreEqual(3, indicator.GetValue(4));
            Assert.AreEqual(2, indicator.GetValue(5));
            Assert.AreEqual(1, indicator.GetValue(6));
            Assert.AreEqual(4, indicator.GetValue(7));
        }
Exemple #9
0
        public void setUp()
        {
            IIndicator <decimal> evaluatedIndicator = new FixeddecimalIndicator(8, 9, 10, 12, 9, 11, 12, 13);

            rule = new CrossedUpIndicatorRule(evaluatedIndicator, Decimals.TEN);
        }
Exemple #10
0
        public void setUp()
        {
            IIndicator <decimal> indicator = new FixeddecimalIndicator(6, 5, 4, 3, 2, 1, 0, -1, 2, 3);

            rule = new IsFallingRule(indicator, 3);
        }
Exemple #11
0
        public void setUp()
        {
            IIndicator <decimal> indicator = new FixeddecimalIndicator(50, 70, 80, 90, 99, 60, 30, 20, 10, 0);

            rule = new InPipeRule(indicator, 80, 20);
        }
Exemple #12
0
        public void setUp()
        {
            IIndicator <decimal> indicator = new FixeddecimalIndicator(20, 10, 0, -20);

            rule = new IsEqualRule(indicator, 20);
        }
Exemple #13
0
        public void setUp()
        {
            IIndicator <decimal> indicator = new FixeddecimalIndicator(1, -5, 3, -6, 5, -7, 0, -1, 2, -8);

            rule = new IsLowestRule(indicator, 3);
        }
        public void setUp()
        {
            IIndicator <decimal> evaluatedIndicator = new FixeddecimalIndicator(12, 11, 10, 9, 11, 8, 7, 6);

            rule = new CrossedDownIndicatorRule(evaluatedIndicator, Decimals.TEN);
        }
Exemple #15
0
        public void setUp()
        {
            IIndicator <decimal> indicator = new FixeddecimalIndicator(1, 5, 3, 6, 5, 7, 0, -1, 2, 3);

            rule = new IsHighestRule(indicator, 3);
        }
        public void setUp()
        {
            IIndicator <decimal> indicator = new FixeddecimalIndicator(20, 15, 10, 5, 0, -5, -10, 100);

            rule = new OverIndicatorRule(indicator, 5);
        }
        public void setUp()
        {
            IIndicator <decimal> indicator = new FixeddecimalIndicator(0, 5, 8, 5, 1, 10, 20, 30);

            rule = new UnderIndicatorRule(indicator, 5);
        }
Exemple #18
0
        public void setUp()
        {
            IIndicator <decimal> indicator = new FixeddecimalIndicator(1, 2, 3, 4, 5, 6, 0, 1, 2, 3);

            rule = new IsRisingRule(indicator, 3);
        }