コード例 #1
0
        /// <summary>
        /// The RSX is a smooth, low lag price-following oscillator that ranges between 0 and 100.
        /// </summary>
        /// <returns></returns>
        public RSX RSX(Data.IDataSeries input, int period)
        {
            if (cacheRSX != null)
            {
                for (int idx = 0; idx < cacheRSX.Length; idx++)
                {
                    if (cacheRSX[idx].Period == period && cacheRSX[idx].EqualsInput(input))
                    {
                        return(cacheRSX[idx]);
                    }
                }
            }

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

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

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

                RSX[] tmp = new RSX[cacheRSX == null ? 1 : cacheRSX.Length + 1];
                if (cacheRSX != null)
                {
                    cacheRSX.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheRSX            = tmp;
                return(indicator);
            }
        }
コード例 #2
0
        protected override void OnBarUpdate()
        {
            #region Indicator Formula
            PriceSeries.Set((High[0] + Low[0] + 2 * Close[0]) / 4);
            TopLineSeries.Set(TopLine);
            BotLineSeries.Set(BotLine);

            RSXvalue = JurikRSX(PriceSeries, _RSX_len)[0];
            RSX.Set(CurrentBar >= 31 ? RSXvalue : 50);
            #endregion

            #region Panel Stabilizer
            Panel_range_min.Set(-1);
            Panel_range_max.Set(101);
            #endregion
        }