예제 #1
0
        /// <summary>
        /// The Aroon Oscillator is based upon his Aroon Indicator. Much like the Aroon Indicator, the Aroon Oscillator measures the strength of a trend.
        /// </summary>
        /// <returns></returns>
        public AroonOscillator AroonOscillator(Data.IDataSeries input, int period)
        {
            if (cacheAroonOscillator != null)
            {
                for (int idx = 0; idx < cacheAroonOscillator.Length; idx++)
                {
                    if (cacheAroonOscillator[idx].Period == period && cacheAroonOscillator[idx].EqualsInput(input))
                    {
                        return(cacheAroonOscillator[idx]);
                    }
                }
            }

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

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

                AroonOscillator indicator = new AroonOscillator();
                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();

                AroonOscillator[] tmp = new AroonOscillator[cacheAroonOscillator == null ? 1 : cacheAroonOscillator.Length + 1];
                if (cacheAroonOscillator != null)
                {
                    cacheAroonOscillator.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]  = indicator;
                cacheAroonOscillator = tmp;
                return(indicator);
            }
        }
예제 #2
0
        /// <summary>
        /// The Aroon Oscillator is based upon his Aroon Indicator. Much like the Aroon Indicator, the Aroon Oscillator measures the strength of a trend.
        /// </summary>
        /// <returns></returns>
        public AroonOscillator AroonOscillator(Data.IDataSeries input, int period)
        {
            if (cacheAroonOscillator != null)
                for (int idx = 0; idx < cacheAroonOscillator.Length; idx++)
                    if (cacheAroonOscillator[idx].Period == period && cacheAroonOscillator[idx].EqualsInput(input))
                        return cacheAroonOscillator[idx];

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

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

                AroonOscillator indicator = new AroonOscillator();
                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();

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