Example #1
0
        /// <summary>
        /// Volume is simply the number of shares (or contracts) traded during a specified time frame (e.g. hour, day, week, month, etc).
        /// </summary>
        /// <returns></returns>
        public VOL VOL(Data.IDataSeries input)
        {
            if (cacheVOL != null)
                for (int idx = 0; idx < cacheVOL.Length; idx++)
                    if (cacheVOL[idx].EqualsInput(input))
                        return cacheVOL[idx];

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

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

                VOL[] tmp = new VOL[cacheVOL == null ? 1 : cacheVOL.Length + 1];
                if (cacheVOL != null)
                    cacheVOL.CopyTo(tmp, 0);
                tmp[tmp.Length - 1] = indicator;
                cacheVOL = tmp;
                return indicator;
            }
        }
Example #2
0
        /// <summary>
        /// Volume is simply the number of shares (or contracts) traded during a specified time frame (e.g. hour, day, week, month, etc).
        /// </summary>
        /// <returns></returns>
        public VOL VOL(Data.IDataSeries input)
        {
            if (cacheVOL != null)
            {
                for (int idx = 0; idx < cacheVOL.Length; idx++)
                {
                    if (cacheVOL[idx].EqualsInput(input))
                    {
                        return(cacheVOL[idx]);
                    }
                }
            }

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

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

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