Ejemplo n.º 1
0
        /// <summary>
        /// customizable CCX
        /// </summary>
        /// <returns></returns>
        public Jurik_CCX_custom Jurik_CCX_custom(Data.IDataSeries input, double _BotLine, double _TopLine, int cCX_len)
        {
            if (cacheJurik_CCX_custom != null)
            {
                for (int idx = 0; idx < cacheJurik_CCX_custom.Length; idx++)
                {
                    if (Math.Abs(cacheJurik_CCX_custom[idx]._BotLine - _BotLine) <= double.Epsilon && Math.Abs(cacheJurik_CCX_custom[idx]._TopLine - _TopLine) <= double.Epsilon && cacheJurik_CCX_custom[idx].CCX_len == cCX_len && cacheJurik_CCX_custom[idx].EqualsInput(input))
                    {
                        return(cacheJurik_CCX_custom[idx]);
                    }
                }
            }

            lock (checkJurik_CCX_custom)
            {
                checkJurik_CCX_custom._BotLine = _BotLine;
                _BotLine = checkJurik_CCX_custom._BotLine;
                checkJurik_CCX_custom._TopLine = _TopLine;
                _TopLine = checkJurik_CCX_custom._TopLine;
                checkJurik_CCX_custom.CCX_len = cCX_len;
                cCX_len = checkJurik_CCX_custom.CCX_len;

                if (cacheJurik_CCX_custom != null)
                {
                    for (int idx = 0; idx < cacheJurik_CCX_custom.Length; idx++)
                    {
                        if (Math.Abs(cacheJurik_CCX_custom[idx]._BotLine - _BotLine) <= double.Epsilon && Math.Abs(cacheJurik_CCX_custom[idx]._TopLine - _TopLine) <= double.Epsilon && cacheJurik_CCX_custom[idx].CCX_len == cCX_len && cacheJurik_CCX_custom[idx].EqualsInput(input))
                        {
                            return(cacheJurik_CCX_custom[idx]);
                        }
                    }
                }

                Jurik_CCX_custom indicator = new Jurik_CCX_custom();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input    = input;
                indicator._BotLine = _BotLine;
                indicator._TopLine = _TopLine;
                indicator.CCX_len  = cCX_len;
                Indicators.Add(indicator);
                indicator.SetUp();

                Jurik_CCX_custom[] tmp = new Jurik_CCX_custom[cacheJurik_CCX_custom == null ? 1 : cacheJurik_CCX_custom.Length + 1];
                if (cacheJurik_CCX_custom != null)
                {
                    cacheJurik_CCX_custom.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]   = indicator;
                cacheJurik_CCX_custom = tmp;
                return(indicator);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// customizable CCX
        /// </summary>
        /// <returns></returns>
        public Jurik_CCX_custom Jurik_CCX_custom(Data.IDataSeries input, double _BotLine, double _TopLine, int cCX_len)
        {
            if (cacheJurik_CCX_custom != null)
                for (int idx = 0; idx < cacheJurik_CCX_custom.Length; idx++)
                    if (Math.Abs(cacheJurik_CCX_custom[idx]._BotLine - _BotLine) <= double.Epsilon && Math.Abs(cacheJurik_CCX_custom[idx]._TopLine - _TopLine) <= double.Epsilon && cacheJurik_CCX_custom[idx].CCX_len == cCX_len && cacheJurik_CCX_custom[idx].EqualsInput(input))
                        return cacheJurik_CCX_custom[idx];

            lock (checkJurik_CCX_custom)
            {
                checkJurik_CCX_custom._BotLine = _BotLine;
                _BotLine = checkJurik_CCX_custom._BotLine;
                checkJurik_CCX_custom._TopLine = _TopLine;
                _TopLine = checkJurik_CCX_custom._TopLine;
                checkJurik_CCX_custom.CCX_len = cCX_len;
                cCX_len = checkJurik_CCX_custom.CCX_len;

                if (cacheJurik_CCX_custom != null)
                    for (int idx = 0; idx < cacheJurik_CCX_custom.Length; idx++)
                        if (Math.Abs(cacheJurik_CCX_custom[idx]._BotLine - _BotLine) <= double.Epsilon && Math.Abs(cacheJurik_CCX_custom[idx]._TopLine - _TopLine) <= double.Epsilon && cacheJurik_CCX_custom[idx].CCX_len == cCX_len && cacheJurik_CCX_custom[idx].EqualsInput(input))
                            return cacheJurik_CCX_custom[idx];

                Jurik_CCX_custom indicator = new Jurik_CCX_custom();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator._BotLine = _BotLine;
                indicator._TopLine = _TopLine;
                indicator.CCX_len = cCX_len;
                Indicators.Add(indicator);
                indicator.SetUp();

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