/// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public CompileMe CompileMe(Data.IDataSeries input, int myInput0)
        {
            if (cacheCompileMe != null)
            {
                for (int idx = 0; idx < cacheCompileMe.Length; idx++)
                {
                    if (cacheCompileMe[idx].MyInput0 == myInput0 && cacheCompileMe[idx].EqualsInput(input))
                    {
                        return(cacheCompileMe[idx]);
                    }
                }
            }

            lock (checkCompileMe)
            {
                checkCompileMe.MyInput0 = myInput0;
                myInput0 = checkCompileMe.MyInput0;

                if (cacheCompileMe != null)
                {
                    for (int idx = 0; idx < cacheCompileMe.Length; idx++)
                    {
                        if (cacheCompileMe[idx].MyInput0 == myInput0 && cacheCompileMe[idx].EqualsInput(input))
                        {
                            return(cacheCompileMe[idx]);
                        }
                    }
                }

                CompileMe indicator = new CompileMe();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input    = input;
                indicator.MyInput0 = myInput0;
                Indicators.Add(indicator);
                indicator.SetUp();

                CompileMe[] tmp = new CompileMe[cacheCompileMe == null ? 1 : cacheCompileMe.Length + 1];
                if (cacheCompileMe != null)
                {
                    cacheCompileMe.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheCompileMe      = tmp;
                return(indicator);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public CompileMe CompileMe(Data.IDataSeries input, int myInput0)
        {
            if (cacheCompileMe != null)
                for (int idx = 0; idx < cacheCompileMe.Length; idx++)
                    if (cacheCompileMe[idx].MyInput0 == myInput0 && cacheCompileMe[idx].EqualsInput(input))
                        return cacheCompileMe[idx];

            lock (checkCompileMe)
            {
                checkCompileMe.MyInput0 = myInput0;
                myInput0 = checkCompileMe.MyInput0;

                if (cacheCompileMe != null)
                    for (int idx = 0; idx < cacheCompileMe.Length; idx++)
                        if (cacheCompileMe[idx].MyInput0 == myInput0 && cacheCompileMe[idx].EqualsInput(input))
                            return cacheCompileMe[idx];

                CompileMe indicator = new CompileMe();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.MyInput0 = myInput0;
                Indicators.Add(indicator);
                indicator.SetUp();

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