Пример #1
0
        /// <summary>
        /// The StochRSI is an oscillator similar in computation to the stochastic measure, except instead of price values as input, the StochRSI uses RSI values. The StochRSI computes the current position of the RSI relative to the high and low RSI values over a specified number of days. The intent of this measure, designed by Tushard Chande and Stanley Kroll, is to provide further information about the overbought/oversold nature of the RSI. The StochRSI ranges between 0.0 and 1.0. Values above 0.8 are generally seen to identify overbought levels and values below 0.2 are considered to indicate oversold conditions.
        /// </summary>
        /// <returns></returns>
        public StochRSI StochRSI(Data.IDataSeries input, int period)
        {
            if (cacheStochRSI != null)
            {
                for (int idx = 0; idx < cacheStochRSI.Length; idx++)
                {
                    if (cacheStochRSI[idx].Period == period && cacheStochRSI[idx].EqualsInput(input))
                    {
                        return(cacheStochRSI[idx]);
                    }
                }
            }

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

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

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

                StochRSI[] tmp = new StochRSI[cacheStochRSI == null ? 1 : cacheStochRSI.Length + 1];
                if (cacheStochRSI != null)
                {
                    cacheStochRSI.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheStochRSI       = tmp;
                return(indicator);
            }
        }
Пример #2
0
        /// <summary>
        /// The StochRSI is an oscillator similar in computation to the stochastic measure, except instead of price values as input, the StochRSI uses RSI values. The StochRSI computes the current position of the RSI relative to the high and low RSI values over a specified number of days. The intent of this measure, designed by Tushard Chande and Stanley Kroll, is to provide further information about the overbought/oversold nature of the RSI. The StochRSI ranges between 0.0 and 1.0. Values above 0.8 are generally seen to identify overbought levels and values below 0.2 are considered to indicate oversold conditions.
        /// </summary>
        /// <returns></returns>
        public StochRSI StochRSI(Data.IDataSeries input, int period)
        {
            if (cacheStochRSI != null)
                for (int idx = 0; idx < cacheStochRSI.Length; idx++)
                    if (cacheStochRSI[idx].Period == period && cacheStochRSI[idx].EqualsInput(input))
                        return cacheStochRSI[idx];

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

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

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

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