예제 #1
0
        /// <summary>
        ///  secondsperbar  number of seconds per bar  > input draws red bar
        /// </summary>
        /// <returns></returns>
        public secondsperbar secondsperbar(Data.IDataSeries input, bool drawSMA, int firstline, int myInput0, int secondline, int sMAPeriod)
        {
            if (cachesecondsperbar != null)
            {
                for (int idx = 0; idx < cachesecondsperbar.Length; idx++)
                {
                    if (cachesecondsperbar[idx].DrawSMA == drawSMA && cachesecondsperbar[idx].Firstline == firstline && cachesecondsperbar[idx].MyInput0 == myInput0 && cachesecondsperbar[idx].Secondline == secondline && cachesecondsperbar[idx].SMAPeriod == sMAPeriod && cachesecondsperbar[idx].EqualsInput(input))
                    {
                        return(cachesecondsperbar[idx]);
                    }
                }
            }

            lock (checksecondsperbar)
            {
                checksecondsperbar.DrawSMA = drawSMA;
                drawSMA = checksecondsperbar.DrawSMA;
                checksecondsperbar.Firstline = firstline;
                firstline = checksecondsperbar.Firstline;
                checksecondsperbar.MyInput0 = myInput0;
                myInput0 = checksecondsperbar.MyInput0;
                checksecondsperbar.Secondline = secondline;
                secondline = checksecondsperbar.Secondline;
                checksecondsperbar.SMAPeriod = sMAPeriod;
                sMAPeriod = checksecondsperbar.SMAPeriod;

                if (cachesecondsperbar != null)
                {
                    for (int idx = 0; idx < cachesecondsperbar.Length; idx++)
                    {
                        if (cachesecondsperbar[idx].DrawSMA == drawSMA && cachesecondsperbar[idx].Firstline == firstline && cachesecondsperbar[idx].MyInput0 == myInput0 && cachesecondsperbar[idx].Secondline == secondline && cachesecondsperbar[idx].SMAPeriod == sMAPeriod && cachesecondsperbar[idx].EqualsInput(input))
                        {
                            return(cachesecondsperbar[idx]);
                        }
                    }
                }

                secondsperbar indicator = new secondsperbar();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input      = input;
                indicator.DrawSMA    = drawSMA;
                indicator.Firstline  = firstline;
                indicator.MyInput0   = myInput0;
                indicator.Secondline = secondline;
                indicator.SMAPeriod  = sMAPeriod;
                Indicators.Add(indicator);
                indicator.SetUp();

                secondsperbar[] tmp = new secondsperbar[cachesecondsperbar == null ? 1 : cachesecondsperbar.Length + 1];
                if (cachesecondsperbar != null)
                {
                    cachesecondsperbar.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cachesecondsperbar  = tmp;
                return(indicator);
            }
        }
예제 #2
0
        /// <summary>
        ///  secondsperbar  number of seconds per bar  > input draws red bar
        /// </summary>
        /// <returns></returns>
        public secondsperbar secondsperbar(Data.IDataSeries input, bool drawSMA, int firstline, int myInput0, int secondline, int sMAPeriod)
        {
            if (cachesecondsperbar != null)
                for (int idx = 0; idx < cachesecondsperbar.Length; idx++)
                    if (cachesecondsperbar[idx].DrawSMA == drawSMA && cachesecondsperbar[idx].Firstline == firstline && cachesecondsperbar[idx].MyInput0 == myInput0 && cachesecondsperbar[idx].Secondline == secondline && cachesecondsperbar[idx].SMAPeriod == sMAPeriod && cachesecondsperbar[idx].EqualsInput(input))
                        return cachesecondsperbar[idx];

            lock (checksecondsperbar)
            {
                checksecondsperbar.DrawSMA = drawSMA;
                drawSMA = checksecondsperbar.DrawSMA;
                checksecondsperbar.Firstline = firstline;
                firstline = checksecondsperbar.Firstline;
                checksecondsperbar.MyInput0 = myInput0;
                myInput0 = checksecondsperbar.MyInput0;
                checksecondsperbar.Secondline = secondline;
                secondline = checksecondsperbar.Secondline;
                checksecondsperbar.SMAPeriod = sMAPeriod;
                sMAPeriod = checksecondsperbar.SMAPeriod;

                if (cachesecondsperbar != null)
                    for (int idx = 0; idx < cachesecondsperbar.Length; idx++)
                        if (cachesecondsperbar[idx].DrawSMA == drawSMA && cachesecondsperbar[idx].Firstline == firstline && cachesecondsperbar[idx].MyInput0 == myInput0 && cachesecondsperbar[idx].Secondline == secondline && cachesecondsperbar[idx].SMAPeriod == sMAPeriod && cachesecondsperbar[idx].EqualsInput(input))
                            return cachesecondsperbar[idx];

                secondsperbar indicator = new secondsperbar();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.DrawSMA = drawSMA;
                indicator.Firstline = firstline;
                indicator.MyInput0 = myInput0;
                indicator.Secondline = secondline;
                indicator.SMAPeriod = sMAPeriod;
                Indicators.Add(indicator);
                indicator.SetUp();

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