Esempio n. 1
0
        /// <summary>
        /// demo -- using Jurik CCX indicator as a function
        /// </summary>
        /// <returns></returns>
        public Jurik_CCX_calling_demo Jurik_CCX_calling_demo(Data.IDataSeries input, double _BotLine, double _TopLine, int cCX_len)
        {
            if (cacheJurik_CCX_calling_demo != null)
            {
                for (int idx = 0; idx < cacheJurik_CCX_calling_demo.Length; idx++)
                {
                    if (Math.Abs(cacheJurik_CCX_calling_demo[idx]._BotLine - _BotLine) <= double.Epsilon && Math.Abs(cacheJurik_CCX_calling_demo[idx]._TopLine - _TopLine) <= double.Epsilon && cacheJurik_CCX_calling_demo[idx].CCX_len == cCX_len && cacheJurik_CCX_calling_demo[idx].EqualsInput(input))
                    {
                        return(cacheJurik_CCX_calling_demo[idx]);
                    }
                }
            }

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

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

                Jurik_CCX_calling_demo indicator = new Jurik_CCX_calling_demo();
                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_calling_demo[] tmp = new Jurik_CCX_calling_demo[cacheJurik_CCX_calling_demo == null ? 1 : cacheJurik_CCX_calling_demo.Length + 1];
                if (cacheJurik_CCX_calling_demo != null)
                {
                    cacheJurik_CCX_calling_demo.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]         = indicator;
                cacheJurik_CCX_calling_demo = tmp;
                return(indicator);
            }
        }
        /// <summary>
        /// demo -- using Jurik CCX indicator as a function
        /// </summary>
        /// <returns></returns>
        public Jurik_CCX_calling_demo Jurik_CCX_calling_demo(Data.IDataSeries input, double _BotLine, double _TopLine, int cCX_len)
        {
            if (cacheJurik_CCX_calling_demo != null)
                for (int idx = 0; idx < cacheJurik_CCX_calling_demo.Length; idx++)
                    if (Math.Abs(cacheJurik_CCX_calling_demo[idx]._BotLine - _BotLine) <= double.Epsilon && Math.Abs(cacheJurik_CCX_calling_demo[idx]._TopLine - _TopLine) <= double.Epsilon && cacheJurik_CCX_calling_demo[idx].CCX_len == cCX_len && cacheJurik_CCX_calling_demo[idx].EqualsInput(input))
                        return cacheJurik_CCX_calling_demo[idx];

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

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

                Jurik_CCX_calling_demo indicator = new Jurik_CCX_calling_demo();
                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_calling_demo[] tmp = new Jurik_CCX_calling_demo[cacheJurik_CCX_calling_demo == null ? 1 : cacheJurik_CCX_calling_demo.Length + 1];
                if (cacheJurik_CCX_calling_demo != null)
                    cacheJurik_CCX_calling_demo.CopyTo(tmp, 0);
                tmp[tmp.Length - 1] = indicator;
                cacheJurik_CCX_calling_demo = tmp;
                return indicator;
            }
        }