예제 #1
0
        /// <summary>
        /// Creates a new schaff trend cycle with 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>
        /// <param name="cyclePeriod">The signal period</param>
        /// <param name="type">The type of moving averages to use</param>
        public SchaffTrendCycle(string name, int cyclePeriod, int fastPeriod, int slowPeriod, MovingAverageType type)
            : base(name)
        {
            //Create MACD indicator and track max and min.
            _MACD    = new MovingAverageConvergenceDivergence(fastPeriod, slowPeriod, cyclePeriod, type);
            _maximum = _MACD.MAX(cyclePeriod, false);
            _minimum = _MACD.MIN(cyclePeriod, false);

            //Stochastics of MACD variables
            _K        = new Identity(name + "_K");
            _D        = type.AsIndicator(3).Of(_K, false);
            _maximumD = _D.MAX(cyclePeriod, false);
            _minimumD = _D.MIN(cyclePeriod, false);

            //Stochastics of MACD Stochastics variables; _PFF is STC
            _PF  = new Identity(name + "_PF");
            _PFF = type.AsIndicator(3).Of(_PF, false);

            WarmUpPeriod = _MACD.WarmUpPeriod;
        }