示例#1
0
        /// <summary>
        /// RIND (Range Indicator) compares the intraday range (high - low) to the inter-day (close - previous close) range. When the intraday range is greater than the inter-day range, the Range Indicator will be a high value. This signals an end to the current trend. When the Range Indicator is at a low level, a new trend is about to start.
        /// </summary>
        /// <returns></returns>
        public RIND RIND(Data.IDataSeries input, int periodQ, int smooth)
        {
            if (cacheRIND != null)
            {
                for (int idx = 0; idx < cacheRIND.Length; idx++)
                {
                    if (cacheRIND[idx].PeriodQ == periodQ && cacheRIND[idx].Smooth == smooth && cacheRIND[idx].EqualsInput(input))
                    {
                        return(cacheRIND[idx]);
                    }
                }
            }

            lock (checkRIND)
            {
                checkRIND.PeriodQ = periodQ;
                periodQ           = checkRIND.PeriodQ;
                checkRIND.Smooth  = smooth;
                smooth            = checkRIND.Smooth;

                if (cacheRIND != null)
                {
                    for (int idx = 0; idx < cacheRIND.Length; idx++)
                    {
                        if (cacheRIND[idx].PeriodQ == periodQ && cacheRIND[idx].Smooth == smooth && cacheRIND[idx].EqualsInput(input))
                        {
                            return(cacheRIND[idx]);
                        }
                    }
                }

                RIND indicator = new RIND();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input   = input;
                indicator.PeriodQ = periodQ;
                indicator.Smooth  = smooth;
                Indicators.Add(indicator);
                indicator.SetUp();

                RIND[] tmp = new RIND[cacheRIND == null ? 1 : cacheRIND.Length + 1];
                if (cacheRIND != null)
                {
                    cacheRIND.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheRIND           = tmp;
                return(indicator);
            }
        }
示例#2
0
        /// <summary>
        /// RIND (Range Indicator) compares the intraday range (high - low) to the inter-day (close - previous close) range. When the intraday range is greater than the inter-day range, the Range Indicator will be a high value. This signals an end to the current trend. When the Range Indicator is at a low level, a new trend is about to start.
        /// </summary>
        /// <returns></returns>
        public RIND RIND(Data.IDataSeries input, int periodQ, int smooth)
        {
            if (cacheRIND != null)
                for (int idx = 0; idx < cacheRIND.Length; idx++)
                    if (cacheRIND[idx].PeriodQ == periodQ && cacheRIND[idx].Smooth == smooth && cacheRIND[idx].EqualsInput(input))
                        return cacheRIND[idx];

            lock (checkRIND)
            {
                checkRIND.PeriodQ = periodQ;
                periodQ = checkRIND.PeriodQ;
                checkRIND.Smooth = smooth;
                smooth = checkRIND.Smooth;

                if (cacheRIND != null)
                    for (int idx = 0; idx < cacheRIND.Length; idx++)
                        if (cacheRIND[idx].PeriodQ == periodQ && cacheRIND[idx].Smooth == smooth && cacheRIND[idx].EqualsInput(input))
                            return cacheRIND[idx];

                RIND indicator = new RIND();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.PeriodQ = periodQ;
                indicator.Smooth = smooth;
                Indicators.Add(indicator);
                indicator.SetUp();

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