Пример #1
0
        /// <summary>
        /// Jurik RSX (Relative Trend Strength Index) is a smoother version of the technical RSI indicator.
        /// </summary>
        /// <returns></returns>
        public JurikRSX JurikRSX(Data.IDataSeries input, double smooth)
        {
            checkJurikRSX.Smooth = smooth;
            smooth = checkJurikRSX.Smooth;

            if (cacheJurikRSX != null)
            {
                for (int idx = 0; idx < cacheJurikRSX.Length; idx++)
                {
                    if (Math.Abs(cacheJurikRSX[idx].Smooth - smooth) <= double.Epsilon && cacheJurikRSX[idx].EqualsInput(input))
                    {
                        return(cacheJurikRSX[idx]);
                    }
                }
            }

            JurikRSX indicator = new JurikRSX();

            indicator.SetUp();
            indicator.CalculateOnBarClose = CalculateOnBarClose;
            indicator.Input  = input;
            indicator.Smooth = smooth;

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

            return(indicator);
        }
Пример #2
0
        /// <summary>
        /// Jurik RSX (Relative Trend Strength Index) is a smoother version of the technical RSI indicator.
        /// </summary>
        /// <returns></returns>
        public JurikRSX JurikRSX(Data.IDataSeries input, double smooth)
        {
            checkJurikRSX.Smooth = smooth;
            smooth = checkJurikRSX.Smooth;

            if (cacheJurikRSX != null)
                for (int idx = 0; idx < cacheJurikRSX.Length; idx++)
                    if (Math.Abs(cacheJurikRSX[idx].Smooth - smooth) <= double.Epsilon && cacheJurikRSX[idx].EqualsInput(input))
                        return cacheJurikRSX[idx];

            JurikRSX indicator = new JurikRSX();
            indicator.SetUp();
            indicator.CalculateOnBarClose = CalculateOnBarClose;
            indicator.Input = input;
            indicator.Smooth = smooth;

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

            return indicator;
        }