Example #1
0
        /// <summary>
        /// Jurik VEL (Zero-Lag Velocity) is a smoother version of the technical indicator 'momentum' with the special feature that the smoothing process has added no additional lag to the original momentum indicator.
        /// </summary>
        /// <returns></returns>
        public JurikVEL JurikVEL(Data.IDataSeries input, int depth)
        {
            checkJurikVEL.Depth = depth;
            depth = checkJurikVEL.Depth;

            if (cacheJurikVEL != null)
            {
                for (int idx = 0; idx < cacheJurikVEL.Length; idx++)
                {
                    if (cacheJurikVEL[idx].Depth == depth && cacheJurikVEL[idx].EqualsInput(input))
                    {
                        return(cacheJurikVEL[idx]);
                    }
                }
            }

            JurikVEL indicator = new JurikVEL();

            indicator.SetUp();
            indicator.CalculateOnBarClose = CalculateOnBarClose;
            indicator.Input = input;
            indicator.Depth = depth;

            JurikVEL[] tmp = new JurikVEL[cacheJurikVEL == null ? 1 : cacheJurikVEL.Length + 1];
            if (cacheJurikVEL != null)
            {
                cacheJurikVEL.CopyTo(tmp, 0);
            }
            tmp[tmp.Length - 1] = indicator;
            cacheJurikVEL       = tmp;
            Indicators.Add(indicator);

            return(indicator);
        }
        /// <summary>
        /// Jurik VEL (Zero-Lag Velocity) is a smoother version of the technical indicator 'momentum' with the special feature that the smoothing process has added no additional lag to the original momentum indicator.
        /// </summary>
        /// <returns></returns>
        public JurikVEL JurikVEL(Data.IDataSeries input, int depth)
        {
            checkJurikVEL.Depth = depth;
            depth = checkJurikVEL.Depth;

            if (cacheJurikVEL != null)
                for (int idx = 0; idx < cacheJurikVEL.Length; idx++)
                    if (cacheJurikVEL[idx].Depth == depth && cacheJurikVEL[idx].EqualsInput(input))
                        return cacheJurikVEL[idx];

            JurikVEL indicator = new JurikVEL();
            indicator.SetUp();
            indicator.CalculateOnBarClose = CalculateOnBarClose;
            indicator.Input = input;
            indicator.Depth = depth;

            JurikVEL[] tmp = new JurikVEL[cacheJurikVEL == null ? 1 : cacheJurikVEL.Length + 1];
            if (cacheJurikVEL != null)
                cacheJurikVEL.CopyTo(tmp, 0);
            tmp[tmp.Length - 1] = indicator;
            cacheJurikVEL = tmp;
            Indicators.Add(indicator);

            return indicator;
        }