예제 #1
0
        private static Rule CreateRandomThresholdRule() // Generate a random Threshold Rule.
        {
            int rndNum = RandomHolder.Instance.Next(6);

            if (rndNum == 0) // Create a Threshold (Overlay, Overlay) rule.
            {
                return(RuleFactory.createThresholdRule(IndicatorFactory.getRandomPriceOverlayIndicator(), IndicatorFactory.getRandomPriceOverlayIndicator()));
            }
            else if (rndNum == 1) // Create a Threshold (Value, Bounded) rule.
            {
                return(RuleFactory.createThresholdRule(IndicatorFactory.createRandomValue(), IndicatorFactory.getRandomBoundedIndicator()));
            }
            else if (rndNum == 2) // Create a Threshold (Value, Unbounded) rule.
            {
                return(RuleFactory.createThresholdRule(IndicatorFactory.createRandomValue(), IndicatorFactory.getRandomUnboundedIndicator()));
            }
            else if (rndNum == 3) // Create a Threshold (Bounded, Bounded) rule.
            {
                return(RuleFactory.createThresholdRule(IndicatorFactory.getRandomBoundedIndicator(), IndicatorFactory.getRandomBoundedIndicator()));
            }
            else if (rndNum == 4) // Create a Threshold (Bounded, Value) rule.
            {
                return(RuleFactory.createThresholdRule(IndicatorFactory.getRandomBoundedIndicator(), IndicatorFactory.createRandomValue()));
            }
            else // Create a Threshold (Unbounded, Value) rule.
            {
                return(RuleFactory.createThresholdRule(IndicatorFactory.getRandomUnboundedIndicator(), IndicatorFactory.createRandomValue()));
            }
        }