/// <summary>
        /// Implements volume bucketing ala Marcos
        /// </summary>
        /// <returns></returns>
        public ZZVPINwithVolumeBar ZZVPINwithVolumeBar(Data.IDataSeries input, int jmaLen, int n_windowsize, int useCDF, int volumeBarSize)
        {
            if (cacheZZVPINwithVolumeBar != null)
            {
                for (int idx = 0; idx < cacheZZVPINwithVolumeBar.Length; idx++)
                {
                    if (cacheZZVPINwithVolumeBar[idx].JmaLen == jmaLen && cacheZZVPINwithVolumeBar[idx].N_windowsize == n_windowsize && cacheZZVPINwithVolumeBar[idx].UseCDF == useCDF && cacheZZVPINwithVolumeBar[idx].VolumeBarSize == volumeBarSize && cacheZZVPINwithVolumeBar[idx].EqualsInput(input))
                    {
                        return(cacheZZVPINwithVolumeBar[idx]);
                    }
                }
            }

            lock (checkZZVPINwithVolumeBar)
            {
                checkZZVPINwithVolumeBar.JmaLen = jmaLen;
                jmaLen = checkZZVPINwithVolumeBar.JmaLen;
                checkZZVPINwithVolumeBar.N_windowsize = n_windowsize;
                n_windowsize = checkZZVPINwithVolumeBar.N_windowsize;
                checkZZVPINwithVolumeBar.UseCDF = useCDF;
                useCDF = checkZZVPINwithVolumeBar.UseCDF;
                checkZZVPINwithVolumeBar.VolumeBarSize = volumeBarSize;
                volumeBarSize = checkZZVPINwithVolumeBar.VolumeBarSize;

                if (cacheZZVPINwithVolumeBar != null)
                {
                    for (int idx = 0; idx < cacheZZVPINwithVolumeBar.Length; idx++)
                    {
                        if (cacheZZVPINwithVolumeBar[idx].JmaLen == jmaLen && cacheZZVPINwithVolumeBar[idx].N_windowsize == n_windowsize && cacheZZVPINwithVolumeBar[idx].UseCDF == useCDF && cacheZZVPINwithVolumeBar[idx].VolumeBarSize == volumeBarSize && cacheZZVPINwithVolumeBar[idx].EqualsInput(input))
                        {
                            return(cacheZZVPINwithVolumeBar[idx]);
                        }
                    }
                }

                ZZVPINwithVolumeBar indicator = new ZZVPINwithVolumeBar();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input         = input;
                indicator.JmaLen        = jmaLen;
                indicator.N_windowsize  = n_windowsize;
                indicator.UseCDF        = useCDF;
                indicator.VolumeBarSize = volumeBarSize;
                Indicators.Add(indicator);
                indicator.SetUp();

                ZZVPINwithVolumeBar[] tmp = new ZZVPINwithVolumeBar[cacheZZVPINwithVolumeBar == null ? 1 : cacheZZVPINwithVolumeBar.Length + 1];
                if (cacheZZVPINwithVolumeBar != null)
                {
                    cacheZZVPINwithVolumeBar.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]      = indicator;
                cacheZZVPINwithVolumeBar = tmp;
                return(indicator);
            }
        }
Пример #2
0
        /// <summary>
        /// Implements volume bucketing ala Marcos
        /// </summary>
        /// <returns></returns>
        public ZZVPINwithVolumeBar ZZVPINwithVolumeBar(Data.IDataSeries input, int jmaLen, int n_windowsize, int useCDF, int volumeBarSize)
        {
            if (cacheZZVPINwithVolumeBar != null)
                for (int idx = 0; idx < cacheZZVPINwithVolumeBar.Length; idx++)
                    if (cacheZZVPINwithVolumeBar[idx].JmaLen == jmaLen && cacheZZVPINwithVolumeBar[idx].N_windowsize == n_windowsize && cacheZZVPINwithVolumeBar[idx].UseCDF == useCDF && cacheZZVPINwithVolumeBar[idx].VolumeBarSize == volumeBarSize && cacheZZVPINwithVolumeBar[idx].EqualsInput(input))
                        return cacheZZVPINwithVolumeBar[idx];

            lock (checkZZVPINwithVolumeBar)
            {
                checkZZVPINwithVolumeBar.JmaLen = jmaLen;
                jmaLen = checkZZVPINwithVolumeBar.JmaLen;
                checkZZVPINwithVolumeBar.N_windowsize = n_windowsize;
                n_windowsize = checkZZVPINwithVolumeBar.N_windowsize;
                checkZZVPINwithVolumeBar.UseCDF = useCDF;
                useCDF = checkZZVPINwithVolumeBar.UseCDF;
                checkZZVPINwithVolumeBar.VolumeBarSize = volumeBarSize;
                volumeBarSize = checkZZVPINwithVolumeBar.VolumeBarSize;

                if (cacheZZVPINwithVolumeBar != null)
                    for (int idx = 0; idx < cacheZZVPINwithVolumeBar.Length; idx++)
                        if (cacheZZVPINwithVolumeBar[idx].JmaLen == jmaLen && cacheZZVPINwithVolumeBar[idx].N_windowsize == n_windowsize && cacheZZVPINwithVolumeBar[idx].UseCDF == useCDF && cacheZZVPINwithVolumeBar[idx].VolumeBarSize == volumeBarSize && cacheZZVPINwithVolumeBar[idx].EqualsInput(input))
                            return cacheZZVPINwithVolumeBar[idx];

                ZZVPINwithVolumeBar indicator = new ZZVPINwithVolumeBar();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.JmaLen = jmaLen;
                indicator.N_windowsize = n_windowsize;
                indicator.UseCDF = useCDF;
                indicator.VolumeBarSize = volumeBarSize;
                Indicators.Add(indicator);
                indicator.SetUp();

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