/// <summary>
        /// This indicator displays opening range and pre-session range for the selected session.
        /// </summary>
        /// <returns></returns>
        public Indicator.anaOpeningRangeV42 anaOpeningRangeV42(Data.IDataSeries input, string cETZone, bool extendOpeningRange, string s_AsianEndTime, string s_AsianStartTime, string s_EuropeanEndTime, string s_EuropeanStartTime, string s_OpeningPeriod, string s_OpeningPeriodOffset, anaPreSessionOR42 selectedPreSession, anaSessionCountOR42 selectedSession, string tSTZone)
        {
            if (InInitialize && input == null)
                throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");

            return _indicator.anaOpeningRangeV42(input, cETZone, extendOpeningRange, s_AsianEndTime, s_AsianStartTime, s_EuropeanEndTime, s_EuropeanStartTime, s_OpeningPeriod, s_OpeningPeriodOffset, selectedPreSession, selectedSession, tSTZone);
        }
		protected override void OnStartUp()
		{
			if (Instrument.MasterInstrument.InstrumentType == Cbi.InstrumentType.Currency || Instrument.MasterInstrument.Name == "DX"|| Instrument.MasterInstrument.Name == "6A"
				|| Instrument.MasterInstrument.Name == "6B" || Instrument.MasterInstrument.Name == "6C" ||Instrument.MasterInstrument.Name == "6E"
				|| Instrument.MasterInstrument.Name == "6J" || Instrument.MasterInstrument.Name == "6M" || Instrument.MasterInstrument.Name == "6S"
				|| Instrument.MasterInstrument.Name == "6N" || Instrument.MasterInstrument.Name == "E7" || Instrument.MasterInstrument.Name == "J7"
				|| Instrument.MasterInstrument.Name == "M6A" || Instrument.MasterInstrument.Name == "M6B" || Instrument.MasterInstrument.Name == "M6C"
				|| Instrument.MasterInstrument.Name == "M6E" || Instrument.MasterInstrument.Name == "M6J" || Instrument.MasterInstrument.Name == "M6S")
				isCurrency = true;
			
			if (selectedSession == anaSessionCountOR42.Auto)
			{
				if (isCurrency)
					activeSession = anaSessionCountOR42.Third;
				else
					activeSession = anaSessionCountOR42.Second;
			}
			else 
				activeSession = selectedSession; 
			
			if (Instrument.MasterInstrument.Name == "FDAX" || Instrument.MasterInstrument.Name == "FESX" ||Instrument.MasterInstrument.Name == "FGBL" ||
				Instrument.MasterInstrument.Name == "FGBM")
			{
				asian	 	= false;
				european 	= false;
				Plots[4].Name = "Pre-High";
				Plots[5].Name = "Pre-Low";
			}	
			else if (selectedPreSession == anaPreSessionOR42.AsianSession)
			{
				asian = true;
				european = false;
				if (asian)
				{
					Plots[4].Name = "AS-High";
					Plots[5].Name = "AS-Low";
				}
			}
			else if (selectedPreSession == anaPreSessionOR42.EuropeanSession)
			{
				asian = false;
				european = true;
				if (european)
				{
					Plots[4].Name = "EU-High";
					Plots[5].Name = "EU-Low";
				}
			}
			else if (selectedPreSession == anaPreSessionOR42.Full)
			{
				asian	 	= false;
				european 	= false;
				Plots[4].Name = "Pre-High";
				Plots[5].Name = "Pre-Low";
			}
			labelFont = new Font ("Arial", labelFontSize);
			if(ChartControl != null)
				errorBrush.Color = ChartControl.AxisColor;
			openingRangeFillBrush = new SolidBrush(Color.FromArgb(25*opacity, openingRangeFillColor));
			Plots[0].Pen.Width = plot0Width;
			Plots[0].Pen.DashStyle = dash0Style;
			Plots[1].Pen.Width= plot0Width;
			Plots[1].Pen.DashStyle = dash0Style;
			Plots[2].Pen.Width = plot2Width;
			Plots[2].Pen.DashStyle = dash2Style;
			Plots[3].Pen.Width = plot3Width;
			Plots[3].Pen.DashStyle = dash3Style;
			Plots[4].Pen.Width= plot4Width;
			Plots[4].Pen.DashStyle = dash4Style;
			Plots[5].Pen.Width = plot4Width;
			Plots[5].Pen.DashStyle = dash4Style;
			Plots[0].Pen.Color = openingRangeColor;
			Plots[1].Pen.Color = openingRangeColor;
			Plots[2].Pen.Color = openingMidColor;
			Plots[3].Pen.Color = regOpenColor;
			Plots[4].Pen.Color = preSessionColor;
			Plots[5].Pen.Color = preSessionColor;
			
			if (!showCurrentOpen || regOpenColor == Color.Transparent)
				plotCurrentOpen = false;
			else
				plotCurrentOpen = true;
			if(!showPreSession || preSessionColor == Color.Transparent)
				plotPreSession = false;
			else
				plotPreSession = true;
			if (AutoScale)
				AutoScale = false;
			if (Instrument.MasterInstrument.InstrumentType == Cbi.InstrumentType.Currency && (TickSize == 0.00001 || TickSize == 0.001))
				displaySize = 5* TickSize;
			else
				displaySize = TickSize;
			shiftPeriod = TimeSpan.Compare(openingPeriodOffset, new TimeSpan(0,0,0));
			if(shiftPeriod < 0 && activeSession == anaSessionCountOR42.First)
			{
				openingPeriodOffset = new TimeSpan(0,0,0);
				shiftPeriod = 0;
			}	
			if (BarsPeriod.Id == PeriodType.Minute || BarsPeriod.Id == PeriodType.Second)
				tickBuilt = false;
			else
				tickBuilt = true;
			countDown = 1;
		}
 public Indicator.anaOpeningRangeV42 anaOpeningRangeV42(string cETZone, bool extendOpeningRange, string s_AsianEndTime, string s_AsianStartTime, string s_EuropeanEndTime, string s_EuropeanStartTime, string s_OpeningPeriod, string s_OpeningPeriodOffset, anaPreSessionOR42 selectedPreSession, anaSessionCountOR42 selectedSession, string tSTZone)
 {
     return _indicator.anaOpeningRangeV42(Input, cETZone, extendOpeningRange, s_AsianEndTime, s_AsianStartTime, s_EuropeanEndTime, s_EuropeanStartTime, s_OpeningPeriod, s_OpeningPeriodOffset, selectedPreSession, selectedSession, tSTZone);
 }
        /// <summary>
        /// This indicator displays opening range and pre-session range for the selected session.
        /// </summary>
        /// <returns></returns>
        public anaOpeningRangeV42 anaOpeningRangeV42(Data.IDataSeries input, string cETZone, bool extendOpeningRange, string s_AsianEndTime, string s_AsianStartTime, string s_EuropeanEndTime, string s_EuropeanStartTime, string s_OpeningPeriod, string s_OpeningPeriodOffset, anaPreSessionOR42 selectedPreSession, anaSessionCountOR42 selectedSession, string tSTZone)
        {
            if (cacheanaOpeningRangeV42 != null)
                for (int idx = 0; idx < cacheanaOpeningRangeV42.Length; idx++)
                    if (cacheanaOpeningRangeV42[idx].CETZone == cETZone && cacheanaOpeningRangeV42[idx].ExtendOpeningRange == extendOpeningRange && cacheanaOpeningRangeV42[idx].S_AsianEndTime == s_AsianEndTime && cacheanaOpeningRangeV42[idx].S_AsianStartTime == s_AsianStartTime && cacheanaOpeningRangeV42[idx].S_EuropeanEndTime == s_EuropeanEndTime && cacheanaOpeningRangeV42[idx].S_EuropeanStartTime == s_EuropeanStartTime && cacheanaOpeningRangeV42[idx].S_OpeningPeriod == s_OpeningPeriod && cacheanaOpeningRangeV42[idx].S_OpeningPeriodOffset == s_OpeningPeriodOffset && cacheanaOpeningRangeV42[idx].SelectedPreSession == selectedPreSession && cacheanaOpeningRangeV42[idx].SelectedSession == selectedSession && cacheanaOpeningRangeV42[idx].TSTZone == tSTZone && cacheanaOpeningRangeV42[idx].EqualsInput(input))
                        return cacheanaOpeningRangeV42[idx];

            lock (checkanaOpeningRangeV42)
            {
                checkanaOpeningRangeV42.CETZone = cETZone;
                cETZone = checkanaOpeningRangeV42.CETZone;
                checkanaOpeningRangeV42.ExtendOpeningRange = extendOpeningRange;
                extendOpeningRange = checkanaOpeningRangeV42.ExtendOpeningRange;
                checkanaOpeningRangeV42.S_AsianEndTime = s_AsianEndTime;
                s_AsianEndTime = checkanaOpeningRangeV42.S_AsianEndTime;
                checkanaOpeningRangeV42.S_AsianStartTime = s_AsianStartTime;
                s_AsianStartTime = checkanaOpeningRangeV42.S_AsianStartTime;
                checkanaOpeningRangeV42.S_EuropeanEndTime = s_EuropeanEndTime;
                s_EuropeanEndTime = checkanaOpeningRangeV42.S_EuropeanEndTime;
                checkanaOpeningRangeV42.S_EuropeanStartTime = s_EuropeanStartTime;
                s_EuropeanStartTime = checkanaOpeningRangeV42.S_EuropeanStartTime;
                checkanaOpeningRangeV42.S_OpeningPeriod = s_OpeningPeriod;
                s_OpeningPeriod = checkanaOpeningRangeV42.S_OpeningPeriod;
                checkanaOpeningRangeV42.S_OpeningPeriodOffset = s_OpeningPeriodOffset;
                s_OpeningPeriodOffset = checkanaOpeningRangeV42.S_OpeningPeriodOffset;
                checkanaOpeningRangeV42.SelectedPreSession = selectedPreSession;
                selectedPreSession = checkanaOpeningRangeV42.SelectedPreSession;
                checkanaOpeningRangeV42.SelectedSession = selectedSession;
                selectedSession = checkanaOpeningRangeV42.SelectedSession;
                checkanaOpeningRangeV42.TSTZone = tSTZone;
                tSTZone = checkanaOpeningRangeV42.TSTZone;

                if (cacheanaOpeningRangeV42 != null)
                    for (int idx = 0; idx < cacheanaOpeningRangeV42.Length; idx++)
                        if (cacheanaOpeningRangeV42[idx].CETZone == cETZone && cacheanaOpeningRangeV42[idx].ExtendOpeningRange == extendOpeningRange && cacheanaOpeningRangeV42[idx].S_AsianEndTime == s_AsianEndTime && cacheanaOpeningRangeV42[idx].S_AsianStartTime == s_AsianStartTime && cacheanaOpeningRangeV42[idx].S_EuropeanEndTime == s_EuropeanEndTime && cacheanaOpeningRangeV42[idx].S_EuropeanStartTime == s_EuropeanStartTime && cacheanaOpeningRangeV42[idx].S_OpeningPeriod == s_OpeningPeriod && cacheanaOpeningRangeV42[idx].S_OpeningPeriodOffset == s_OpeningPeriodOffset && cacheanaOpeningRangeV42[idx].SelectedPreSession == selectedPreSession && cacheanaOpeningRangeV42[idx].SelectedSession == selectedSession && cacheanaOpeningRangeV42[idx].TSTZone == tSTZone && cacheanaOpeningRangeV42[idx].EqualsInput(input))
                            return cacheanaOpeningRangeV42[idx];

                anaOpeningRangeV42 indicator = new anaOpeningRangeV42();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.CETZone = cETZone;
                indicator.ExtendOpeningRange = extendOpeningRange;
                indicator.S_AsianEndTime = s_AsianEndTime;
                indicator.S_AsianStartTime = s_AsianStartTime;
                indicator.S_EuropeanEndTime = s_EuropeanEndTime;
                indicator.S_EuropeanStartTime = s_EuropeanStartTime;
                indicator.S_OpeningPeriod = s_OpeningPeriod;
                indicator.S_OpeningPeriodOffset = s_OpeningPeriodOffset;
                indicator.SelectedPreSession = selectedPreSession;
                indicator.SelectedSession = selectedSession;
                indicator.TSTZone = tSTZone;
                Indicators.Add(indicator);
                indicator.SetUp();

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