コード例 #1
0
        /// <summary>
        ///      Computes the next value of this indicator from the given state
        /// </summary>
        /// <param name="time"></param>
        /// <param name="input">The input given to the indicator</param>
        /// <returns>
        ///      A new value for this indicator
        /// </returns>
        protected override DoubleArray Forward(long time, DoubleArray input)
        {
            _fastWma.Update(time, input);
            _slowWma.Update(time, input);
            if (_fastWma.IsReady && _slowWma.IsReady)
            {
                _hullMa.Update(time, 2 * _fastWma - _slowWma);
            }

            return(_hullMa.Current);
        }
コード例 #2
0
        /// <summary>
        ///      Computes the next value of this indicator from the given state
        /// </summary>
        /// <param name="time"></param>
        /// <param name="input">The input given to the indicator</param>
        /// <returns>A new value for this indicator</returns>
        protected override DoubleArray Forward(long time, DoubleArray input)
        {
            _shortRoc.Update(time, input);
            _longRoc.Update(time, input);
            if (!_longRoc.IsReady || !_shortRoc.IsReady)
            {
                return(Constants.Zero);
            }

            _lwma.Update(time, _shortRoc + _longRoc);
            return(_lwma);
        }