protected override void OnStartUp()
 {
     smooth     = zDexpSmooth(smoothAlpha, 1, false);
     cycle      = new DataSeries(this);
     deltaphase = new DataSeries(this);
     zsw        = zSortedWindow(deltaphase, 5, true);
 }
示例#2
0
        /// <summary>
        /// Double Exponential Smoothing p146 in Bowerman book.
        /// </summary>
        /// <returns></returns>
        public zDexpSmooth zDexpSmooth(Data.IDataSeries input, double alpha, int tau, bool trackStandardDeviations)
        {
            if (cachezDexpSmooth != null)
            {
                for (int idx = 0; idx < cachezDexpSmooth.Length; idx++)
                {
                    if (Math.Abs(cachezDexpSmooth[idx].Alpha - alpha) <= double.Epsilon && cachezDexpSmooth[idx].Tau == tau && cachezDexpSmooth[idx].TrackStandardDeviations == trackStandardDeviations && cachezDexpSmooth[idx].EqualsInput(input))
                    {
                        return(cachezDexpSmooth[idx]);
                    }
                }
            }

            lock (checkzDexpSmooth)
            {
                checkzDexpSmooth.Alpha = alpha;
                alpha = checkzDexpSmooth.Alpha;
                checkzDexpSmooth.Tau = tau;
                tau = checkzDexpSmooth.Tau;
                checkzDexpSmooth.TrackStandardDeviations = trackStandardDeviations;
                trackStandardDeviations = checkzDexpSmooth.TrackStandardDeviations;

                if (cachezDexpSmooth != null)
                {
                    for (int idx = 0; idx < cachezDexpSmooth.Length; idx++)
                    {
                        if (Math.Abs(cachezDexpSmooth[idx].Alpha - alpha) <= double.Epsilon && cachezDexpSmooth[idx].Tau == tau && cachezDexpSmooth[idx].TrackStandardDeviations == trackStandardDeviations && cachezDexpSmooth[idx].EqualsInput(input))
                        {
                            return(cachezDexpSmooth[idx]);
                        }
                    }
                }

                zDexpSmooth indicator = new zDexpSmooth();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.Alpha = alpha;
                indicator.Tau   = tau;
                indicator.TrackStandardDeviations = trackStandardDeviations;
                Indicators.Add(indicator);
                indicator.SetUp();

                zDexpSmooth[] tmp = new zDexpSmooth[cachezDexpSmooth == null ? 1 : cachezDexpSmooth.Length + 1];
                if (cachezDexpSmooth != null)
                {
                    cachezDexpSmooth.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cachezDexpSmooth    = tmp;
                return(indicator);
            }
        }
 protected override void OnStartUp()
 {
     smooth = zDexpSmooth(smalpha, 1, false);
     cycle  = new DataSeries(this);
     cycper = zzCyclePeriod(0.07, 0.3333);
 }
示例#4
0
 protected override void OnStartUp()
 {
     mom  = Momentum(Median, momo);
     dexp = zDexpSmooth(mom, alpha, 1);
 }
示例#5
0
 protected override void OnStartUp()
 {
     dexp = zDexpSmooth(alpha, 1, true);
 }
示例#6
0
 protected override void OnStartUp()
 {
     fast = zDexpSmooth(alpha1, tau);
     slow = zDexpSmooth(alpha2, tau);
 }
示例#7
0
 protected override void OnStartUp()
 {
     smooth = zDexpSmooth(smalpha, 1, false);
 }