예제 #1
0
        /// <summary>
        /// customizable RSX
        /// </summary>
        /// <returns></returns>
        public Jurik_RSX_custom Jurik_RSX_custom(Data.IDataSeries input, double _RSX_len, double botLine, double topLine)
        {
            if (cacheJurik_RSX_custom != null)
            {
                for (int idx = 0; idx < cacheJurik_RSX_custom.Length; idx++)
                {
                    if (Math.Abs(cacheJurik_RSX_custom[idx]._RSX_len - _RSX_len) <= double.Epsilon && Math.Abs(cacheJurik_RSX_custom[idx].BotLine - botLine) <= double.Epsilon && Math.Abs(cacheJurik_RSX_custom[idx].TopLine - topLine) <= double.Epsilon && cacheJurik_RSX_custom[idx].EqualsInput(input))
                    {
                        return(cacheJurik_RSX_custom[idx]);
                    }
                }
            }

            lock (checkJurik_RSX_custom)
            {
                checkJurik_RSX_custom._RSX_len = _RSX_len;
                _RSX_len = checkJurik_RSX_custom._RSX_len;
                checkJurik_RSX_custom.BotLine = botLine;
                botLine = checkJurik_RSX_custom.BotLine;
                checkJurik_RSX_custom.TopLine = topLine;
                topLine = checkJurik_RSX_custom.TopLine;

                if (cacheJurik_RSX_custom != null)
                {
                    for (int idx = 0; idx < cacheJurik_RSX_custom.Length; idx++)
                    {
                        if (Math.Abs(cacheJurik_RSX_custom[idx]._RSX_len - _RSX_len) <= double.Epsilon && Math.Abs(cacheJurik_RSX_custom[idx].BotLine - botLine) <= double.Epsilon && Math.Abs(cacheJurik_RSX_custom[idx].TopLine - topLine) <= double.Epsilon && cacheJurik_RSX_custom[idx].EqualsInput(input))
                        {
                            return(cacheJurik_RSX_custom[idx]);
                        }
                    }
                }

                Jurik_RSX_custom indicator = new Jurik_RSX_custom();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input    = input;
                indicator._RSX_len = _RSX_len;
                indicator.BotLine  = botLine;
                indicator.TopLine  = topLine;
                Indicators.Add(indicator);
                indicator.SetUp();

                Jurik_RSX_custom[] tmp = new Jurik_RSX_custom[cacheJurik_RSX_custom == null ? 1 : cacheJurik_RSX_custom.Length + 1];
                if (cacheJurik_RSX_custom != null)
                {
                    cacheJurik_RSX_custom.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]   = indicator;
                cacheJurik_RSX_custom = tmp;
                return(indicator);
            }
        }
예제 #2
0
        /// <summary>
        /// customizable RSX
        /// </summary>
        /// <returns></returns>
        public Jurik_RSX_custom Jurik_RSX_custom(Data.IDataSeries input, double _RSX_len, double botLine, double topLine)
        {
            if (cacheJurik_RSX_custom != null)
                for (int idx = 0; idx < cacheJurik_RSX_custom.Length; idx++)
                    if (Math.Abs(cacheJurik_RSX_custom[idx]._RSX_len - _RSX_len) <= double.Epsilon && Math.Abs(cacheJurik_RSX_custom[idx].BotLine - botLine) <= double.Epsilon && Math.Abs(cacheJurik_RSX_custom[idx].TopLine - topLine) <= double.Epsilon && cacheJurik_RSX_custom[idx].EqualsInput(input))
                        return cacheJurik_RSX_custom[idx];

            lock (checkJurik_RSX_custom)
            {
                checkJurik_RSX_custom._RSX_len = _RSX_len;
                _RSX_len = checkJurik_RSX_custom._RSX_len;
                checkJurik_RSX_custom.BotLine = botLine;
                botLine = checkJurik_RSX_custom.BotLine;
                checkJurik_RSX_custom.TopLine = topLine;
                topLine = checkJurik_RSX_custom.TopLine;

                if (cacheJurik_RSX_custom != null)
                    for (int idx = 0; idx < cacheJurik_RSX_custom.Length; idx++)
                        if (Math.Abs(cacheJurik_RSX_custom[idx]._RSX_len - _RSX_len) <= double.Epsilon && Math.Abs(cacheJurik_RSX_custom[idx].BotLine - botLine) <= double.Epsilon && Math.Abs(cacheJurik_RSX_custom[idx].TopLine - topLine) <= double.Epsilon && cacheJurik_RSX_custom[idx].EqualsInput(input))
                            return cacheJurik_RSX_custom[idx];

                Jurik_RSX_custom indicator = new Jurik_RSX_custom();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator._RSX_len = _RSX_len;
                indicator.BotLine = botLine;
                indicator.TopLine = topLine;
                Indicators.Add(indicator);
                indicator.SetUp();

                Jurik_RSX_custom[] tmp = new Jurik_RSX_custom[cacheJurik_RSX_custom == null ? 1 : cacheJurik_RSX_custom.Length + 1];
                if (cacheJurik_RSX_custom != null)
                    cacheJurik_RSX_custom.CopyTo(tmp, 0);
                tmp[tmp.Length - 1] = indicator;
                cacheJurik_RSX_custom = tmp;
                return indicator;
            }
        }