protected override void OnStartUp()
 {
     smooth     = zDexpSmooth(smoothAlpha, 1, false);
     cycle      = new DataSeries(this);
     deltaphase = new DataSeries(this);
     zsw        = zSortedWindow(deltaphase, 5, true);
 }
        /// <summary>
        /// sorted window
        /// </summary>
        /// <returns></returns>
        public zSortedWindow zSortedWindow(Data.IDataSeries input, int length)
        {
            if (cachezSortedWindow != null)
            {
                for (int idx = 0; idx < cachezSortedWindow.Length; idx++)
                {
                    if (cachezSortedWindow[idx].Length == length && cachezSortedWindow[idx].EqualsInput(input))
                    {
                        return(cachezSortedWindow[idx]);
                    }
                }
            }

            lock (checkzSortedWindow)
            {
                checkzSortedWindow.Length = length;
                length = checkzSortedWindow.Length;

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

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

                zSortedWindow[] tmp = new zSortedWindow[cachezSortedWindow == null ? 1 : cachezSortedWindow.Length + 1];
                if (cachezSortedWindow != null)
                {
                    cachezSortedWindow.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cachezSortedWindow  = tmp;
                return(indicator);
            }
        }
示例#3
0
 protected override void OnStartUp()
 {
     ham = HAMedians(hAAlpha);
     med = zSortedWindow(ham.Value, windowLength);
 }