Пример #1
0
        /// <summary>
        /// customizable VEL
        /// </summary>
        /// <returns></returns>
        public Jurik_VEL_custom Jurik_VEL_custom(Data.IDataSeries input, int __VEL_len, int _NormSwitch, double lowerLine, double upperLine)
        {
            if (cacheJurik_VEL_custom != null)
            {
                for (int idx = 0; idx < cacheJurik_VEL_custom.Length; idx++)
                {
                    if (cacheJurik_VEL_custom[idx].__VEL_len == __VEL_len && cacheJurik_VEL_custom[idx]._NormSwitch == _NormSwitch && Math.Abs(cacheJurik_VEL_custom[idx].LowerLine - lowerLine) <= double.Epsilon && Math.Abs(cacheJurik_VEL_custom[idx].UpperLine - upperLine) <= double.Epsilon && cacheJurik_VEL_custom[idx].EqualsInput(input))
                    {
                        return(cacheJurik_VEL_custom[idx]);
                    }
                }
            }

            lock (checkJurik_VEL_custom)
            {
                checkJurik_VEL_custom.__VEL_len = __VEL_len;
                __VEL_len = checkJurik_VEL_custom.__VEL_len;
                checkJurik_VEL_custom._NormSwitch = _NormSwitch;
                _NormSwitch = checkJurik_VEL_custom._NormSwitch;
                checkJurik_VEL_custom.LowerLine = lowerLine;
                lowerLine = checkJurik_VEL_custom.LowerLine;
                checkJurik_VEL_custom.UpperLine = upperLine;
                upperLine = checkJurik_VEL_custom.UpperLine;

                if (cacheJurik_VEL_custom != null)
                {
                    for (int idx = 0; idx < cacheJurik_VEL_custom.Length; idx++)
                    {
                        if (cacheJurik_VEL_custom[idx].__VEL_len == __VEL_len && cacheJurik_VEL_custom[idx]._NormSwitch == _NormSwitch && Math.Abs(cacheJurik_VEL_custom[idx].LowerLine - lowerLine) <= double.Epsilon && Math.Abs(cacheJurik_VEL_custom[idx].UpperLine - upperLine) <= double.Epsilon && cacheJurik_VEL_custom[idx].EqualsInput(input))
                        {
                            return(cacheJurik_VEL_custom[idx]);
                        }
                    }
                }

                Jurik_VEL_custom indicator = new Jurik_VEL_custom();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input       = input;
                indicator.__VEL_len   = __VEL_len;
                indicator._NormSwitch = _NormSwitch;
                indicator.LowerLine   = lowerLine;
                indicator.UpperLine   = upperLine;
                Indicators.Add(indicator);
                indicator.SetUp();

                Jurik_VEL_custom[] tmp = new Jurik_VEL_custom[cacheJurik_VEL_custom == null ? 1 : cacheJurik_VEL_custom.Length + 1];
                if (cacheJurik_VEL_custom != null)
                {
                    cacheJurik_VEL_custom.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]   = indicator;
                cacheJurik_VEL_custom = tmp;
                return(indicator);
            }
        }
Пример #2
0
        /// <summary>
        /// customizable VEL
        /// </summary>
        /// <returns></returns>
        public Jurik_VEL_custom Jurik_VEL_custom(Data.IDataSeries input, int __VEL_len, int _NormSwitch, double lowerLine, double upperLine)
        {
            if (cacheJurik_VEL_custom != null)
                for (int idx = 0; idx < cacheJurik_VEL_custom.Length; idx++)
                    if (cacheJurik_VEL_custom[idx].__VEL_len == __VEL_len && cacheJurik_VEL_custom[idx]._NormSwitch == _NormSwitch && Math.Abs(cacheJurik_VEL_custom[idx].LowerLine - lowerLine) <= double.Epsilon && Math.Abs(cacheJurik_VEL_custom[idx].UpperLine - upperLine) <= double.Epsilon && cacheJurik_VEL_custom[idx].EqualsInput(input))
                        return cacheJurik_VEL_custom[idx];

            lock (checkJurik_VEL_custom)
            {
                checkJurik_VEL_custom.__VEL_len = __VEL_len;
                __VEL_len = checkJurik_VEL_custom.__VEL_len;
                checkJurik_VEL_custom._NormSwitch = _NormSwitch;
                _NormSwitch = checkJurik_VEL_custom._NormSwitch;
                checkJurik_VEL_custom.LowerLine = lowerLine;
                lowerLine = checkJurik_VEL_custom.LowerLine;
                checkJurik_VEL_custom.UpperLine = upperLine;
                upperLine = checkJurik_VEL_custom.UpperLine;

                if (cacheJurik_VEL_custom != null)
                    for (int idx = 0; idx < cacheJurik_VEL_custom.Length; idx++)
                        if (cacheJurik_VEL_custom[idx].__VEL_len == __VEL_len && cacheJurik_VEL_custom[idx]._NormSwitch == _NormSwitch && Math.Abs(cacheJurik_VEL_custom[idx].LowerLine - lowerLine) <= double.Epsilon && Math.Abs(cacheJurik_VEL_custom[idx].UpperLine - upperLine) <= double.Epsilon && cacheJurik_VEL_custom[idx].EqualsInput(input))
                            return cacheJurik_VEL_custom[idx];

                Jurik_VEL_custom indicator = new Jurik_VEL_custom();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.__VEL_len = __VEL_len;
                indicator._NormSwitch = _NormSwitch;
                indicator.LowerLine = lowerLine;
                indicator.UpperLine = upperLine;
                Indicators.Add(indicator);
                indicator.SetUp();

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