Ejemplo n.º 1
0
        /// <summary>
        /// custom DMX +/-
        /// </summary>
        /// <returns></returns>
        public Jurik_DMX_plusminus Jurik_DMX_plusminus(Data.IDataSeries input, double _Threshold, int dMX_len)
        {
            if (cacheJurik_DMX_plusminus != null)
            {
                for (int idx = 0; idx < cacheJurik_DMX_plusminus.Length; idx++)
                {
                    if (Math.Abs(cacheJurik_DMX_plusminus[idx]._Threshold - _Threshold) <= double.Epsilon && cacheJurik_DMX_plusminus[idx].DMX_len == dMX_len && cacheJurik_DMX_plusminus[idx].EqualsInput(input))
                    {
                        return(cacheJurik_DMX_plusminus[idx]);
                    }
                }
            }

            lock (checkJurik_DMX_plusminus)
            {
                checkJurik_DMX_plusminus._Threshold = _Threshold;
                _Threshold = checkJurik_DMX_plusminus._Threshold;
                checkJurik_DMX_plusminus.DMX_len = dMX_len;
                dMX_len = checkJurik_DMX_plusminus.DMX_len;

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

                Jurik_DMX_plusminus indicator = new Jurik_DMX_plusminus();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input      = input;
                indicator._Threshold = _Threshold;
                indicator.DMX_len    = dMX_len;
                Indicators.Add(indicator);
                indicator.SetUp();

                Jurik_DMX_plusminus[] tmp = new Jurik_DMX_plusminus[cacheJurik_DMX_plusminus == null ? 1 : cacheJurik_DMX_plusminus.Length + 1];
                if (cacheJurik_DMX_plusminus != null)
                {
                    cacheJurik_DMX_plusminus.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]      = indicator;
                cacheJurik_DMX_plusminus = tmp;
                return(indicator);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// custom DMX +/-
        /// </summary>
        /// <returns></returns>
        public Jurik_DMX_plusminus Jurik_DMX_plusminus(Data.IDataSeries input, double _Threshold, int dMX_len)
        {
            if (cacheJurik_DMX_plusminus != null)
                for (int idx = 0; idx < cacheJurik_DMX_plusminus.Length; idx++)
                    if (Math.Abs(cacheJurik_DMX_plusminus[idx]._Threshold - _Threshold) <= double.Epsilon && cacheJurik_DMX_plusminus[idx].DMX_len == dMX_len && cacheJurik_DMX_plusminus[idx].EqualsInput(input))
                        return cacheJurik_DMX_plusminus[idx];

            lock (checkJurik_DMX_plusminus)
            {
                checkJurik_DMX_plusminus._Threshold = _Threshold;
                _Threshold = checkJurik_DMX_plusminus._Threshold;
                checkJurik_DMX_plusminus.DMX_len = dMX_len;
                dMX_len = checkJurik_DMX_plusminus.DMX_len;

                if (cacheJurik_DMX_plusminus != null)
                    for (int idx = 0; idx < cacheJurik_DMX_plusminus.Length; idx++)
                        if (Math.Abs(cacheJurik_DMX_plusminus[idx]._Threshold - _Threshold) <= double.Epsilon && cacheJurik_DMX_plusminus[idx].DMX_len == dMX_len && cacheJurik_DMX_plusminus[idx].EqualsInput(input))
                            return cacheJurik_DMX_plusminus[idx];

                Jurik_DMX_plusminus indicator = new Jurik_DMX_plusminus();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator._Threshold = _Threshold;
                indicator.DMX_len = dMX_len;
                Indicators.Add(indicator);
                indicator.SetUp();

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