示例#1
0
        /// <summary>
        /// A signal on ACD return 1, if signal true
        /// </summary>
        /// <returns></returns>
        public ZZACD00Asignal ZZACD00Asignal(Data.IDataSeries input, int numBarAsignal, int oRNumBars)
        {
            if (cacheZZACD00Asignal != null)
            {
                for (int idx = 0; idx < cacheZZACD00Asignal.Length; idx++)
                {
                    if (cacheZZACD00Asignal[idx].NumBarAsignal == numBarAsignal && cacheZZACD00Asignal[idx].ORNumBars == oRNumBars && cacheZZACD00Asignal[idx].EqualsInput(input))
                    {
                        return(cacheZZACD00Asignal[idx]);
                    }
                }
            }

            lock (checkZZACD00Asignal)
            {
                checkZZACD00Asignal.NumBarAsignal = numBarAsignal;
                numBarAsignal = checkZZACD00Asignal.NumBarAsignal;
                checkZZACD00Asignal.ORNumBars = oRNumBars;
                oRNumBars = checkZZACD00Asignal.ORNumBars;

                if (cacheZZACD00Asignal != null)
                {
                    for (int idx = 0; idx < cacheZZACD00Asignal.Length; idx++)
                    {
                        if (cacheZZACD00Asignal[idx].NumBarAsignal == numBarAsignal && cacheZZACD00Asignal[idx].ORNumBars == oRNumBars && cacheZZACD00Asignal[idx].EqualsInput(input))
                        {
                            return(cacheZZACD00Asignal[idx]);
                        }
                    }
                }

                ZZACD00Asignal indicator = new ZZACD00Asignal();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input         = input;
                indicator.NumBarAsignal = numBarAsignal;
                indicator.ORNumBars     = oRNumBars;
                Indicators.Add(indicator);
                indicator.SetUp();

                ZZACD00Asignal[] tmp = new ZZACD00Asignal[cacheZZACD00Asignal == null ? 1 : cacheZZACD00Asignal.Length + 1];
                if (cacheZZACD00Asignal != null)
                {
                    cacheZZACD00Asignal.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheZZACD00Asignal = tmp;
                return(indicator);
            }
        }
示例#2
0
        /// <summary>
        /// A signal on ACD return 1, if signal true
        /// </summary>
        /// <returns></returns>
        public ZZACD00Asignal ZZACD00Asignal(Data.IDataSeries input, int numBarAsignal, int oRNumBars)
        {
            if (cacheZZACD00Asignal != null)
                for (int idx = 0; idx < cacheZZACD00Asignal.Length; idx++)
                    if (cacheZZACD00Asignal[idx].NumBarAsignal == numBarAsignal && cacheZZACD00Asignal[idx].ORNumBars == oRNumBars && cacheZZACD00Asignal[idx].EqualsInput(input))
                        return cacheZZACD00Asignal[idx];

            lock (checkZZACD00Asignal)
            {
                checkZZACD00Asignal.NumBarAsignal = numBarAsignal;
                numBarAsignal = checkZZACD00Asignal.NumBarAsignal;
                checkZZACD00Asignal.ORNumBars = oRNumBars;
                oRNumBars = checkZZACD00Asignal.ORNumBars;

                if (cacheZZACD00Asignal != null)
                    for (int idx = 0; idx < cacheZZACD00Asignal.Length; idx++)
                        if (cacheZZACD00Asignal[idx].NumBarAsignal == numBarAsignal && cacheZZACD00Asignal[idx].ORNumBars == oRNumBars && cacheZZACD00Asignal[idx].EqualsInput(input))
                            return cacheZZACD00Asignal[idx];

                ZZACD00Asignal indicator = new ZZACD00Asignal();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.NumBarAsignal = numBarAsignal;
                indicator.ORNumBars = oRNumBars;
                Indicators.Add(indicator);
                indicator.SetUp();

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