Пример #1
0
        /// <summary>
        /// The Aroon Indicator was developed by Tushar Chande. Its comprised of two plots one measuring the number of periods since the most recent x-period high (Aroon Up) and the other measuring the number of periods since the most recent x-period low (Aroon Down).
        /// </summary>
        /// <returns></returns>
        public Aroon Aroon(Data.IDataSeries input, int period)
        {
            if (cacheAroon != null)
            {
                for (int idx = 0; idx < cacheAroon.Length; idx++)
                {
                    if (cacheAroon[idx].Period == period && cacheAroon[idx].EqualsInput(input))
                    {
                        return(cacheAroon[idx]);
                    }
                }
            }

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

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

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

                Aroon[] tmp = new Aroon[cacheAroon == null ? 1 : cacheAroon.Length + 1];
                if (cacheAroon != null)
                {
                    cacheAroon.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheAroon          = tmp;
                return(indicator);
            }
        }
Пример #2
0
        /// <summary>
        /// The Aroon Indicator was developed by Tushar Chande. Its comprised of two plots one measuring the number of periods since the most recent x-period high (Aroon Up) and the other measuring the number of periods since the most recent x-period low (Aroon Down).
        /// </summary>
        /// <returns></returns>
        public Aroon Aroon(Data.IDataSeries input, int period)
        {
            if (cacheAroon != null)
                for (int idx = 0; idx < cacheAroon.Length; idx++)
                    if (cacheAroon[idx].Period == period && cacheAroon[idx].EqualsInput(input))
                        return cacheAroon[idx];

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

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

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

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