コード例 #1
0
        /// <summary>
        /// Tick per Second
        /// </summary>
        /// <returns></returns>
        public TicksPerSecond_Counter_v1 TicksPerSecond_Counter_v1(Data.IDataSeries input)
        {
            if (cacheTicksPerSecond_Counter_v1 != null)
            {
                for (int idx = 0; idx < cacheTicksPerSecond_Counter_v1.Length; idx++)
                {
                    if (cacheTicksPerSecond_Counter_v1[idx].EqualsInput(input))
                    {
                        return(cacheTicksPerSecond_Counter_v1[idx]);
                    }
                }
            }

            lock (checkTicksPerSecond_Counter_v1)
            {
                if (cacheTicksPerSecond_Counter_v1 != null)
                {
                    for (int idx = 0; idx < cacheTicksPerSecond_Counter_v1.Length; idx++)
                    {
                        if (cacheTicksPerSecond_Counter_v1[idx].EqualsInput(input))
                        {
                            return(cacheTicksPerSecond_Counter_v1[idx]);
                        }
                    }
                }

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

                TicksPerSecond_Counter_v1[] tmp = new TicksPerSecond_Counter_v1[cacheTicksPerSecond_Counter_v1 == null ? 1 : cacheTicksPerSecond_Counter_v1.Length + 1];
                if (cacheTicksPerSecond_Counter_v1 != null)
                {
                    cacheTicksPerSecond_Counter_v1.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]            = indicator;
                cacheTicksPerSecond_Counter_v1 = tmp;
                return(indicator);
            }
        }
コード例 #2
0
        /// <summary>
        /// Tick per Second
        /// </summary>
        /// <returns></returns>
        public TicksPerSecond_Counter_v1 TicksPerSecond_Counter_v1(Data.IDataSeries input)
        {
            if (cacheTicksPerSecond_Counter_v1 != null)
                for (int idx = 0; idx < cacheTicksPerSecond_Counter_v1.Length; idx++)
                    if (cacheTicksPerSecond_Counter_v1[idx].EqualsInput(input))
                        return cacheTicksPerSecond_Counter_v1[idx];

            lock (checkTicksPerSecond_Counter_v1)
            {
                if (cacheTicksPerSecond_Counter_v1 != null)
                    for (int idx = 0; idx < cacheTicksPerSecond_Counter_v1.Length; idx++)
                        if (cacheTicksPerSecond_Counter_v1[idx].EqualsInput(input))
                            return cacheTicksPerSecond_Counter_v1[idx];

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

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