Exemplo n.º 1
0
        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public HilbertTransform HilbertTransform(Data.IDataSeries input, int wMAPeriods)
        {
            if (cacheHilbertTransform != null)
            {
                for (int idx = 0; idx < cacheHilbertTransform.Length; idx++)
                {
                    if (cacheHilbertTransform[idx].WMAPeriods == wMAPeriods && cacheHilbertTransform[idx].EqualsInput(input))
                    {
                        return(cacheHilbertTransform[idx]);
                    }
                }
            }

            lock (checkHilbertTransform)
            {
                checkHilbertTransform.WMAPeriods = wMAPeriods;
                wMAPeriods = checkHilbertTransform.WMAPeriods;

                if (cacheHilbertTransform != null)
                {
                    for (int idx = 0; idx < cacheHilbertTransform.Length; idx++)
                    {
                        if (cacheHilbertTransform[idx].WMAPeriods == wMAPeriods && cacheHilbertTransform[idx].EqualsInput(input))
                        {
                            return(cacheHilbertTransform[idx]);
                        }
                    }
                }

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

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

            lock (checkHilbertTransform)
            {
                checkHilbertTransform.WMAPeriods = wMAPeriods;
                wMAPeriods = checkHilbertTransform.WMAPeriods;

                if (cacheHilbertTransform != null)
                    for (int idx = 0; idx < cacheHilbertTransform.Length; idx++)
                        if (cacheHilbertTransform[idx].WMAPeriods == wMAPeriods && cacheHilbertTransform[idx].EqualsInput(input))
                            return cacheHilbertTransform[idx];

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

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