/// <summary>
        /// anaCurrentWeekOHLV43.
        /// </summary>
        /// <returns></returns>
        public Indicator.anaCurrentWeekOHLV43 anaCurrentWeekOHLV43(Data.IDataSeries input, anaSessionTypeCW43 currentSession, int factorNoiseBands, int factorWeeklyRange, int rangePeriod1, int rangePeriod2, anaSessionCountCW43 selectedSession, bool showCurrentOpen, bool showFibonacci, bool showHiLo, bool showMidline, bool showNoiseLevels, bool showTargetLevels, anaTargetTypeCW43 targetType)
        {
            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.anaCurrentWeekOHLV43(input, currentSession, factorNoiseBands, factorWeeklyRange, rangePeriod1, rangePeriod2, selectedSession, showCurrentOpen, showFibonacci, showHiLo, showMidline, showNoiseLevels, showTargetLevels, targetType);
        }
		/// <summary>
		/// </summary>
		protected override void OnStartUp()
		{
			if (Instrument.MasterInstrument.InstrumentType == InstrumentType.Future &&
				(Instrument.MasterInstrument.Name == "EMD" ||Instrument.MasterInstrument.Name == "ES" || Instrument.MasterInstrument.Name == "NQ" 
				||Instrument.MasterInstrument.Name == "YM"||Instrument.MasterInstrument.Name == "GE" ||Instrument.MasterInstrument.Name == "SR" 
				||Instrument.MasterInstrument.Name == "UB"||Instrument.MasterInstrument.Name == "ZB" ||Instrument.MasterInstrument.Name == "ZF"
				||Instrument.MasterInstrument.Name == "ZN"||Instrument.MasterInstrument.Name == "ZQ" ||Instrument.MasterInstrument.Name == "ZT"
				||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 == "6N"||Instrument.MasterInstrument.Name == "6S" ||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"||Instrument.MasterInstrument.Name == "CL" ||Instrument.MasterInstrument.Name == "EH"
				||Instrument.MasterInstrument.Name == "GC"||Instrument.MasterInstrument.Name == "HG" ||Instrument.MasterInstrument.Name == "HO"
				||Instrument.MasterInstrument.Name == "NG"||Instrument.MasterInstrument.Name == "QG" ||Instrument.MasterInstrument.Name == "QM"
				||Instrument.MasterInstrument.Name == "RB"||Instrument.MasterInstrument.Name == "SI" ||Instrument.MasterInstrument.Name == "YG" 
				||Instrument.MasterInstrument.Name == "YI"||Instrument.MasterInstrument.Name == "GF" ||Instrument.MasterInstrument.Name == "GPB"
				||Instrument.MasterInstrument.Name == "HE"||Instrument.MasterInstrument.Name == "LE" ||Instrument.MasterInstrument.Name == "YC"
				||Instrument.MasterInstrument.Name == "YK"||Instrument.MasterInstrument.Name == "YW" ||Instrument.MasterInstrument.Name == "ZC"
				||Instrument.MasterInstrument.Name == "ZE"||Instrument.MasterInstrument.Name == "ZL" ||Instrument.MasterInstrument.Name == "ZM"
				||Instrument.MasterInstrument.Name == "ZO"||Instrument.MasterInstrument.Name == "ZR" ||Instrument.MasterInstrument.Name == "ZS"
				||Instrument.MasterInstrument.Name == "ZW"))				
				isGlobex = true;
			if (isGlobex)
			{
				publicHoliday[0] = publicHoliday0;
				publicHoliday[1] = publicHoliday1;
				publicHoliday[2] = publicHoliday2;
				publicHoliday[3] = publicHoliday3;
			}			
			else for(int i=0; i<4; i++)
				publicHoliday[i] = Cbi.Globals.MinDate;

			displayFactor = 1;
			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 (Instrument.MasterInstrument.Name == "6J")
					displayFactor = 1000000;
				else if (Instrument.MasterInstrument.Name == "USDJPY" || Instrument.MasterInstrument.Name == "EURJPY")
					displayFactor = 100;
				else
					displayFactor = 10000;
			}
			if (selectedSession == anaSessionCountCW43.Auto)
			{
				if (isCurrency)
					activeSession = anaSessionCountCW43.Third;
				else
					activeSession = anaSessionCountCW43.Second;
			}
			else 
				activeSession = selectedSession; 
			if(showRangeData == anaDataLocationCW43.Left_Format_Long || showRangeData == anaDataLocationCW43.Right_Format_Long || showRangeData == anaDataLocationCW43.Center_Format_Long) 
			{
				if (currentSession == anaSessionTypeCW43.ETH)
				{
					if(targetType== anaTargetTypeCW43.Average_Weekly_Range)
					{
						rangeText0 = "Current Weekly Range ETH = ";
						rangeText1 = "Average Weekly Range [" + rangePeriod1 + "] = ";
						rangeText2 = "Average Weekly Range [" + rangePeriod2 + "] = ";
					}
					else
					{
						rangeText0 = "Current Weekly Expansion ETH = ";
						rangeText1 = "Average Weekly Expansion [" + rangePeriod1 + "] = ";
						rangeText2 = "Average Weekly Expansion [" + rangePeriod2 + "] = ";
					}
					noiseText0 = "Current Weekly Noise ETH = ";
					noiseText1 = "Average Weekly Noise [" + rangePeriod1 + "] = ";
					noiseText2 = "Average Weekly Noise [" + rangePeriod2 + "] = ";
					rthOHL = false;
				}
				else
				{
					if(targetType== anaTargetTypeCW43.Average_Weekly_Range)
					{
						rangeText0 = "Current Weekly Range RTH = ";
						rangeText1 = "Average Weekly Range [" + rangePeriod1 + "] = ";
						rangeText2 = "Average Weekly Range [" + rangePeriod2 + "] = ";
					}
					else
					{
						rangeText0 = "Current Weekly Expansion RTH = ";
						rangeText1 = "Average Weekly Expansion [" + rangePeriod1 + "] = ";
						rangeText2 = "Average Weekly Expansion [" + rangePeriod2 + "] = ";
					}
					noiseText0 = "Current Weekly Noise RTH = ";
					noiseText1 = "Average Weekly Noise [" + rangePeriod1 + "] = ";
					noiseText2 = "Average Weekly Noise [" + rangePeriod2 + "] = ";
					rthOHL = true;
				}
			}
			else if(showRangeData == anaDataLocationCW43.Left_Format_Short || showRangeData == anaDataLocationCW43.Right_Format_Short || showRangeData == anaDataLocationCW43.Center_Format_Short) 
			{
				if (currentSession == anaSessionTypeCW43.ETH)
				{
					if(targetType== anaTargetTypeCW43.Average_Weekly_Range)
					{
						rangeText0 = "CWR ETH = ";
						rangeText1 = "AWR [" + rangePeriod1 + "] = ";
						rangeText2 = "AWR [" + rangePeriod2 + "] = ";
					}
					else
					{
						rangeText0 = "CWE ETH = ";
						rangeText1 = "AWE [" + rangePeriod1 + "] = ";
						rangeText2 = "AWE [" + rangePeriod2 + "] = ";
					}
					noiseText0 = "CWN ETH = ";
					noiseText1 = "AWN [" + rangePeriod1 + "] = ";
					noiseText2 = "AWN [" + rangePeriod2 + "] = ";
					rthOHL = false;
				}
				else
				{
					if(targetType== anaTargetTypeCW43.Average_Weekly_Range)
					{
						rangeText0 = "CWR RTH = ";
						rangeText1 = "AWR [" + rangePeriod1 + "] = ";
						rangeText2 = "AWR [" + rangePeriod2 + "] = ";
					}
					else
					{
						rangeText0 = "CWE RTH = ";
						rangeText1 = "AWE [" + rangePeriod1 + "] = ";
						rangeText2 = "AWE [" + rangePeriod2 + "] = ";
					}
					noiseText0 = "CWN RTH = ";
					noiseText1 = "AWN [" + rangePeriod1 + "] = ";
					noiseText2 = "AWN [" + rangePeriod2 + "] = ";
					rthOHL = true;
				}
			}
			else
			{
				if (currentSession == anaSessionTypeCW43.ETH)
					rthOHL = false;
				else
					rthOHL = true;
			}
			if(targetType == anaTargetTypeCW43.Average_Weekly_Range)
			{
				Plots[10].Name = "AWR-High";
				Plots[11].Name = "AWR-Low";
			}				
			else	
			{
				Plots[10].Name = "AWE-High";
				Plots[11].Name = "AWE-Low";
			}				
			labelFont = new Font ("Arial", labelFontSize);
			textFont = new Font ("Arial", textFontSize);
			textBrush = new SolidBrush(textColor);
			noiseBrush = new SolidBrush(Color.FromArgb(25 * opacityN, noiseBandColor));
			targetBrush = new SolidBrush(Color.FromArgb(25 * opacityT, targetBandColor));
			dataBrush = new SolidBrush(Color.FromArgb(25 * opacityD, dataTableColor));
			if (!showCurrentOpen || openColor == Color.Transparent)
				plotCurrentOpen = false;
			else
				plotCurrentOpen = true;
			if (!showHiLo && (highColor == Color.Transparent && lowColor == Color.Transparent))
				plotHiLo = false;
			else
				plotHiLo = true;
			if (!showMidline && midlineColor == Color.Transparent)
				plotMidline = false;
			else
				plotMidline = true;
			if (!showFibonacci || fibColor == Color.Transparent)
				plotFibonacci = false;
			else
				plotFibonacci = true;
			if (!showNoiseLevels || noiseBandColor == Color.Transparent)
				plotNoiseLevels = false;
			else
				plotNoiseLevels = true;
			if (!showTargetLevels || targetBandColor == Color.Transparent)
				plotTargetLevels = false;
			else
				plotTargetLevels = true;
			if (showCurrentOpen)
				Plots[0].Pen.Color = openColor;
			else
				Plots[0].Pen.Color = Color.Transparent;
			if (showHiLo)
			{
				Plots[1].Pen.Color = highColor;
				Plots[2].Pen.Color = lowColor;
			}
			else
			{
				Plots[1].Pen.Color = Color.Transparent;
				Plots[2].Pen.Color = Color.Transparent;
			}
			if(showMidline)
				Plots[3].Pen.Color = midlineColor;
			else
				Plots[3].Pen.Color = Color.Transparent;
			if (showFibonacci)
			{
				Plots[4].Pen.Color = fibColor;
				Plots[5].Pen.Color = fibColor;
				Plots[6].Pen.Color = fibColor;
				Plots[7].Pen.Color = fibColor;
			}
			else
			{
				Plots[4].Pen.Color = Color.Transparent;
				Plots[5].Pen.Color = Color.Transparent;
				Plots[6].Pen.Color = Color.Transparent;
				Plots[7].Pen.Color = Color.Transparent;
			}
			if (showNoiseLevels)
			{
				Plots[8].Pen.Color = noiseBandColor;
				Plots[9].Pen.Color = noiseBandColor;
			}
			else
			{
				Plots[8].Pen.Color = Color.Transparent;
				Plots[9].Pen.Color = Color.Transparent;
			}
			if(showTargetLevels)
			{
				Plots[10].Pen.Color = targetBandColor;
				Plots[11].Pen.Color = targetBandColor;
			}
			else
			{
				Plots[10].Pen.Color = Color.Transparent;
				Plots[11].Pen.Color = Color.Transparent;
			}
			Plots[0].Pen.Width = plot0Width;
			Plots[0].Pen.DashStyle = dash0Style;
			for (int i = 1; i < 3; i++)
			{
				Plots[i].Pen.Width = plot1Width;
				Plots[i].Pen.DashStyle = dash1Style;
			}
			for (int i = 3; i < 8; i++)
			{
				Plots[i].Pen.Width = plot3Width;
				Plots[i].Pen.DashStyle = dash3Style;
			}			
			for (int i = 8; i< 12; i++)
			{
				Plots[i].Pen.Width = plot8Width;
				Plots[i].Pen.DashStyle = dash8Style;
			}				
			rangePeriod = Math.Max(rangePeriod1, rangePeriod2);
			if(ChartControl != null)
			{
				errorBrush.Color = ChartControl.AxisColor;
				errorData5 = errorData5 + (rangePeriod + 1)+ errorData5b;
			}
			if (Instrument.MasterInstrument.InstrumentType == Cbi.InstrumentType.Currency && (TickSize == 0.00001 || TickSize == 0.001))
				displaySize = 5* TickSize;
			else
				displaySize = TickSize;
			if (AutoScale)
				AutoScale = false;
			if(Displacement != 0)
				Displacement = 0;
			noiseList  = new List<double>();
			rangeList  = new List<double>();
			for (int i=0; i < rangePeriod; i++)
			{
				noiseList.Add(0.0);
				rangeList.Add(0.0);
			}
			if (!Bars.BarsType.IsIntraday || BarsPeriod.Id == PeriodType.Minute || BarsPeriod.Id == PeriodType.Second)
				tickBuilt = false;
			else
				tickBuilt = true;
			countDown = 0;
			weekCount = 0;
		}
 public Indicator.anaCurrentWeekOHLV43 anaCurrentWeekOHLV43(anaSessionTypeCW43 currentSession, int factorNoiseBands, int factorWeeklyRange, int rangePeriod1, int rangePeriod2, anaSessionCountCW43 selectedSession, bool showCurrentOpen, bool showFibonacci, bool showHiLo, bool showMidline, bool showNoiseLevels, bool showTargetLevels, anaTargetTypeCW43 targetType)
 {
     return _indicator.anaCurrentWeekOHLV43(Input, currentSession, factorNoiseBands, factorWeeklyRange, rangePeriod1, rangePeriod2, selectedSession, showCurrentOpen, showFibonacci, showHiLo, showMidline, showNoiseLevels, showTargetLevels, targetType);
 }
        /// <summary>
        /// anaCurrentWeekOHLV43.
        /// </summary>
        /// <returns></returns>
        public anaCurrentWeekOHLV43 anaCurrentWeekOHLV43(Data.IDataSeries input, anaSessionTypeCW43 currentSession, int factorNoiseBands, int factorWeeklyRange, int rangePeriod1, int rangePeriod2, anaSessionCountCW43 selectedSession, bool showCurrentOpen, bool showFibonacci, bool showHiLo, bool showMidline, bool showNoiseLevels, bool showTargetLevels, anaTargetTypeCW43 targetType)
        {
            if (cacheanaCurrentWeekOHLV43 != null)
                for (int idx = 0; idx < cacheanaCurrentWeekOHLV43.Length; idx++)
                    if (cacheanaCurrentWeekOHLV43[idx].CurrentSession == currentSession && cacheanaCurrentWeekOHLV43[idx].FactorNoiseBands == factorNoiseBands && cacheanaCurrentWeekOHLV43[idx].FactorWeeklyRange == factorWeeklyRange && cacheanaCurrentWeekOHLV43[idx].RangePeriod1 == rangePeriod1 && cacheanaCurrentWeekOHLV43[idx].RangePeriod2 == rangePeriod2 && cacheanaCurrentWeekOHLV43[idx].SelectedSession == selectedSession && cacheanaCurrentWeekOHLV43[idx].ShowCurrentOpen == showCurrentOpen && cacheanaCurrentWeekOHLV43[idx].ShowFibonacci == showFibonacci && cacheanaCurrentWeekOHLV43[idx].ShowHiLo == showHiLo && cacheanaCurrentWeekOHLV43[idx].ShowMidline == showMidline && cacheanaCurrentWeekOHLV43[idx].ShowNoiseLevels == showNoiseLevels && cacheanaCurrentWeekOHLV43[idx].ShowTargetLevels == showTargetLevels && cacheanaCurrentWeekOHLV43[idx].TargetType == targetType && cacheanaCurrentWeekOHLV43[idx].EqualsInput(input))
                        return cacheanaCurrentWeekOHLV43[idx];

            lock (checkanaCurrentWeekOHLV43)
            {
                checkanaCurrentWeekOHLV43.CurrentSession = currentSession;
                currentSession = checkanaCurrentWeekOHLV43.CurrentSession;
                checkanaCurrentWeekOHLV43.FactorNoiseBands = factorNoiseBands;
                factorNoiseBands = checkanaCurrentWeekOHLV43.FactorNoiseBands;
                checkanaCurrentWeekOHLV43.FactorWeeklyRange = factorWeeklyRange;
                factorWeeklyRange = checkanaCurrentWeekOHLV43.FactorWeeklyRange;
                checkanaCurrentWeekOHLV43.RangePeriod1 = rangePeriod1;
                rangePeriod1 = checkanaCurrentWeekOHLV43.RangePeriod1;
                checkanaCurrentWeekOHLV43.RangePeriod2 = rangePeriod2;
                rangePeriod2 = checkanaCurrentWeekOHLV43.RangePeriod2;
                checkanaCurrentWeekOHLV43.SelectedSession = selectedSession;
                selectedSession = checkanaCurrentWeekOHLV43.SelectedSession;
                checkanaCurrentWeekOHLV43.ShowCurrentOpen = showCurrentOpen;
                showCurrentOpen = checkanaCurrentWeekOHLV43.ShowCurrentOpen;
                checkanaCurrentWeekOHLV43.ShowFibonacci = showFibonacci;
                showFibonacci = checkanaCurrentWeekOHLV43.ShowFibonacci;
                checkanaCurrentWeekOHLV43.ShowHiLo = showHiLo;
                showHiLo = checkanaCurrentWeekOHLV43.ShowHiLo;
                checkanaCurrentWeekOHLV43.ShowMidline = showMidline;
                showMidline = checkanaCurrentWeekOHLV43.ShowMidline;
                checkanaCurrentWeekOHLV43.ShowNoiseLevels = showNoiseLevels;
                showNoiseLevels = checkanaCurrentWeekOHLV43.ShowNoiseLevels;
                checkanaCurrentWeekOHLV43.ShowTargetLevels = showTargetLevels;
                showTargetLevels = checkanaCurrentWeekOHLV43.ShowTargetLevels;
                checkanaCurrentWeekOHLV43.TargetType = targetType;
                targetType = checkanaCurrentWeekOHLV43.TargetType;

                if (cacheanaCurrentWeekOHLV43 != null)
                    for (int idx = 0; idx < cacheanaCurrentWeekOHLV43.Length; idx++)
                        if (cacheanaCurrentWeekOHLV43[idx].CurrentSession == currentSession && cacheanaCurrentWeekOHLV43[idx].FactorNoiseBands == factorNoiseBands && cacheanaCurrentWeekOHLV43[idx].FactorWeeklyRange == factorWeeklyRange && cacheanaCurrentWeekOHLV43[idx].RangePeriod1 == rangePeriod1 && cacheanaCurrentWeekOHLV43[idx].RangePeriod2 == rangePeriod2 && cacheanaCurrentWeekOHLV43[idx].SelectedSession == selectedSession && cacheanaCurrentWeekOHLV43[idx].ShowCurrentOpen == showCurrentOpen && cacheanaCurrentWeekOHLV43[idx].ShowFibonacci == showFibonacci && cacheanaCurrentWeekOHLV43[idx].ShowHiLo == showHiLo && cacheanaCurrentWeekOHLV43[idx].ShowMidline == showMidline && cacheanaCurrentWeekOHLV43[idx].ShowNoiseLevels == showNoiseLevels && cacheanaCurrentWeekOHLV43[idx].ShowTargetLevels == showTargetLevels && cacheanaCurrentWeekOHLV43[idx].TargetType == targetType && cacheanaCurrentWeekOHLV43[idx].EqualsInput(input))
                            return cacheanaCurrentWeekOHLV43[idx];

                anaCurrentWeekOHLV43 indicator = new anaCurrentWeekOHLV43();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.CurrentSession = currentSession;
                indicator.FactorNoiseBands = factorNoiseBands;
                indicator.FactorWeeklyRange = factorWeeklyRange;
                indicator.RangePeriod1 = rangePeriod1;
                indicator.RangePeriod2 = rangePeriod2;
                indicator.SelectedSession = selectedSession;
                indicator.ShowCurrentOpen = showCurrentOpen;
                indicator.ShowFibonacci = showFibonacci;
                indicator.ShowHiLo = showHiLo;
                indicator.ShowMidline = showMidline;
                indicator.ShowNoiseLevels = showNoiseLevels;
                indicator.ShowTargetLevels = showTargetLevels;
                indicator.TargetType = targetType;
                Indicators.Add(indicator);
                indicator.SetUp();

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