/// <summary>
        /// Plots the open, high, and low values from the session starting on the current day.
        /// </summary>
        /// <returns></returns>
        public CurrentDayOHL CurrentDayOHL(Data.IDataSeries input)
        {
            if (cacheCurrentDayOHL != null)
            {
                for (int idx = 0; idx < cacheCurrentDayOHL.Length; idx++)
                {
                    if (cacheCurrentDayOHL[idx].EqualsInput(input))
                    {
                        return(cacheCurrentDayOHL[idx]);
                    }
                }
            }

            lock (checkCurrentDayOHL)
            {
                if (cacheCurrentDayOHL != null)
                {
                    for (int idx = 0; idx < cacheCurrentDayOHL.Length; idx++)
                    {
                        if (cacheCurrentDayOHL[idx].EqualsInput(input))
                        {
                            return(cacheCurrentDayOHL[idx]);
                        }
                    }
                }

                CurrentDayOHL indicator = new CurrentDayOHL();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                Indicators.Add(indicator);
                indicator.SetUp();

                CurrentDayOHL[] tmp = new CurrentDayOHL[cacheCurrentDayOHL == null ? 1 : cacheCurrentDayOHL.Length + 1];
                if (cacheCurrentDayOHL != null)
                {
                    cacheCurrentDayOHL.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheCurrentDayOHL  = tmp;
                return(indicator);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Plots the open, high, and low values from the session starting on the current day.
        /// </summary>
        /// <returns></returns>
        public CurrentDayOHL CurrentDayOHL(Data.IDataSeries input)
        {
            if (cacheCurrentDayOHL != null)
                for (int idx = 0; idx < cacheCurrentDayOHL.Length; idx++)
                    if (cacheCurrentDayOHL[idx].EqualsInput(input))
                        return cacheCurrentDayOHL[idx];

            lock (checkCurrentDayOHL)
            {
                if (cacheCurrentDayOHL != null)
                    for (int idx = 0; idx < cacheCurrentDayOHL.Length; idx++)
                        if (cacheCurrentDayOHL[idx].EqualsInput(input))
                            return cacheCurrentDayOHL[idx];

                CurrentDayOHL indicator = new CurrentDayOHL();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                Indicators.Add(indicator);
                indicator.SetUp();

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