Ejemplo n.º 1
0
        /// <summary>
        /// Returns the low value of the past n periods.
        /// </summary>
        /// <returns></returns>
        public jhlMIN jhlMIN(Data.IDataSeries input, int period)
        {
            if (cachejhlMIN != null)
            {
                for (int idx = 0; idx < cachejhlMIN.Length; idx++)
                {
                    if (cachejhlMIN[idx].Period == period && cachejhlMIN[idx].EqualsInput(input))
                    {
                        return(cachejhlMIN[idx]);
                    }
                }
            }

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

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

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

                jhlMIN[] tmp = new jhlMIN[cachejhlMIN == null ? 1 : cachejhlMIN.Length + 1];
                if (cachejhlMIN != null)
                {
                    cachejhlMIN.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cachejhlMIN         = tmp;
                return(indicator);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns the low value of the past n periods.
        /// </summary>
        /// <returns></returns>
        public jhlMIN jhlMIN(Data.IDataSeries input, int period)
        {
            if (cachejhlMIN != null)
                for (int idx = 0; idx < cachejhlMIN.Length; idx++)
                    if (cachejhlMIN[idx].Period == period && cachejhlMIN[idx].EqualsInput(input))
                        return cachejhlMIN[idx];

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

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

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

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