示例#1
0
 protected override void OnStartUp()
 {
     maxlb  = Z20100527FastMAX(High, lookBack);
     minlb  = Z20100527FastMIN(Low, lookBack);
     maxlen = Z20100527FastMAX(High, length);
     minlen = Z20100527FastMIN(Low, length);
     myatr  = ATR(length);
 }
示例#2
0
        protected override void OnStartUp()
        {
            _diff = new DataSeries(this);

            curL = new double[4];
            oldL = new double[4];

            sw   = Z20091120SortedWindow(_diff, 5);
            fmax = Z20100527FastMAX(_diff, period);
            fmin = Z20100527FastMIN(_diff, period);
        }
示例#3
0
        /// <summary>
        /// Faster MAX
        /// </summary>
        /// <returns></returns>
        public Z20100527FastMAX Z20100527FastMAX(Data.IDataSeries input, int period)
        {
            if (cacheZ20100527FastMAX != null)
            {
                for (int idx = 0; idx < cacheZ20100527FastMAX.Length; idx++)
                {
                    if (cacheZ20100527FastMAX[idx].Period == period && cacheZ20100527FastMAX[idx].EqualsInput(input))
                    {
                        return(cacheZ20100527FastMAX[idx]);
                    }
                }
            }

            lock (checkZ20100527FastMAX)
            {
                checkZ20100527FastMAX.Period = period;
                period = checkZ20100527FastMAX.Period;

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

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

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