Ejemplo n.º 1
0
        /// <summary>
        /// Jurik DMX and T3
        /// </summary>
        /// <returns></returns>
        public Jurik_DMX_and_T3 Jurik_DMX_and_T3(Data.IDataSeries input, int dMX_len, double t3_boost, double t3_len)
        {
            if (cacheJurik_DMX_and_T3 != null)
            {
                for (int idx = 0; idx < cacheJurik_DMX_and_T3.Length; idx++)
                {
                    if (cacheJurik_DMX_and_T3[idx].DMX_len == dMX_len && Math.Abs(cacheJurik_DMX_and_T3[idx].T3_boost - t3_boost) <= double.Epsilon && Math.Abs(cacheJurik_DMX_and_T3[idx].T3_len - t3_len) <= double.Epsilon && cacheJurik_DMX_and_T3[idx].EqualsInput(input))
                    {
                        return(cacheJurik_DMX_and_T3[idx]);
                    }
                }
            }

            lock (checkJurik_DMX_and_T3)
            {
                checkJurik_DMX_and_T3.DMX_len = dMX_len;
                dMX_len = checkJurik_DMX_and_T3.DMX_len;
                checkJurik_DMX_and_T3.T3_boost = t3_boost;
                t3_boost = checkJurik_DMX_and_T3.T3_boost;
                checkJurik_DMX_and_T3.T3_len = t3_len;
                t3_len = checkJurik_DMX_and_T3.T3_len;

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

                Jurik_DMX_and_T3 indicator = new Jurik_DMX_and_T3();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input    = input;
                indicator.DMX_len  = dMX_len;
                indicator.T3_boost = t3_boost;
                indicator.T3_len   = t3_len;
                Indicators.Add(indicator);
                indicator.SetUp();

                Jurik_DMX_and_T3[] tmp = new Jurik_DMX_and_T3[cacheJurik_DMX_and_T3 == null ? 1 : cacheJurik_DMX_and_T3.Length + 1];
                if (cacheJurik_DMX_and_T3 != null)
                {
                    cacheJurik_DMX_and_T3.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]   = indicator;
                cacheJurik_DMX_and_T3 = tmp;
                return(indicator);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Jurik DMX and T3
        /// </summary>
        /// <returns></returns>
        public Jurik_DMX_and_T3 Jurik_DMX_and_T3(Data.IDataSeries input, int dMX_len, double t3_boost, double t3_len)
        {
            if (cacheJurik_DMX_and_T3 != null)
                for (int idx = 0; idx < cacheJurik_DMX_and_T3.Length; idx++)
                    if (cacheJurik_DMX_and_T3[idx].DMX_len == dMX_len && Math.Abs(cacheJurik_DMX_and_T3[idx].T3_boost - t3_boost) <= double.Epsilon && Math.Abs(cacheJurik_DMX_and_T3[idx].T3_len - t3_len) <= double.Epsilon && cacheJurik_DMX_and_T3[idx].EqualsInput(input))
                        return cacheJurik_DMX_and_T3[idx];

            lock (checkJurik_DMX_and_T3)
            {
                checkJurik_DMX_and_T3.DMX_len = dMX_len;
                dMX_len = checkJurik_DMX_and_T3.DMX_len;
                checkJurik_DMX_and_T3.T3_boost = t3_boost;
                t3_boost = checkJurik_DMX_and_T3.T3_boost;
                checkJurik_DMX_and_T3.T3_len = t3_len;
                t3_len = checkJurik_DMX_and_T3.T3_len;

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

                Jurik_DMX_and_T3 indicator = new Jurik_DMX_and_T3();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.DMX_len = dMX_len;
                indicator.T3_boost = t3_boost;
                indicator.T3_len = t3_len;
                Indicators.Add(indicator);
                indicator.SetUp();

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