/// <summary>
        /// Daily Session Pivots.
        /// </summary>
        /// <returns></returns>
        public Indicator.anaPivotsDailyV43 anaPivotsDailyV43(Data.IDataSeries input, anaSessionCountPD43 activeSession, anaCalcModePD43 calcMode, anaPivotStylesPD43 pivotFormula, anaSessionTypePD43 pivotSession, bool showMidpivots, bool showPriorPeriods, double userDefinedClose, double userDefinedHigh, double userDefinedLow)
        {
            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.anaPivotsDailyV43(input, activeSession, calcMode, pivotFormula, pivotSession, showMidpivots, showPriorPeriods, userDefinedClose, userDefinedHigh, userDefinedLow);
        }
		/// <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;
				publicHoliday[4] = publicHoliday4;
				publicHoliday[5] = publicHoliday5;
				publicHoliday[6] = publicHoliday6;
				publicHoliday[7] = publicHoliday7;
				publicHoliday[8] = publicHoliday8;
				publicHoliday[9] = publicHoliday9;
				publicHoliday[10] = publicHoliday10;
				publicHoliday[11] = publicHoliday11;
				publicHoliday[12] = publicHoliday12;
				publicHoliday[13] = publicHoliday13;
				publicHoliday[14] = publicHoliday14;
				publicHoliday[15] = publicHoliday15;
				publicHoliday[16] = publicHoliday16;
				publicHoliday[17] = publicHoliday17;
				publicHoliday[18] = publicHoliday18;
				publicHoliday[19] = publicHoliday19;
				publicHoliday[20] = publicHoliday20;
				publicHoliday[21] = publicHoliday21;
				publicHoliday[22] = publicHoliday22;
				publicHoliday[23] = publicHoliday23;
				publicHoliday[24] = publicHoliday24;
				publicHoliday[25] = publicHoliday25;
				publicHoliday[26] = publicHoliday26;
				publicHoliday[27] = publicHoliday27;
				publicHoliday[28] = publicHoliday28;
				publicHoliday[29] = publicHoliday29;
				publicHoliday[30] = publicHoliday30;
				publicHoliday[31] = publicHoliday31;
				publicHoliday[32] = publicHoliday32;
				publicHoliday[33] = publicHoliday33;
				publicHoliday[34] = publicHoliday34;
				publicHoliday[35] = publicHoliday35;
				publicHoliday[36] = publicHoliday36;
				publicHoliday[37] = publicHoliday37;
				publicHoliday[38] = publicHoliday38;
				publicHoliday[39] = publicHoliday39;
				publicHoliday[40] = publicHoliday40;
				publicHoliday[41] = publicHoliday41;
			}			
			else for(int i=0; i<42; i++)
				publicHoliday[i] = Cbi.Globals.MinDate;

			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 (pivotSession == anaSessionTypePD43.Auto && isCurrency)
				selectedSession = anaSessionTypePD43.ETH;
			else if(pivotSession == anaSessionTypePD43.Auto)
				selectedSession = anaSessionTypePD43.RTH;
			else
				selectedSession = pivotSession;
			labelFont = new Font ("Arial", labelFontSize);
			if (PivotFormula == anaPivotStylesPD43.Jackson)
			{
				Plots[0].Name = "PP";
				Plots[1].Name = "R1";
				Plots[2].Name = "S1";
				Plots[3].Name = "RB1";
				Plots[4].Name = "SB1";
				Plots[5].Name = "R2";
				Plots[6].Name = "S2";
				Plots[7].Name = "RB2";
				Plots[8].Name = "SB2";
				Plots[9].Name = "R3";
				Plots[10].Name = "S3";
				jacksonBrush = new SolidBrush(Color.FromArgb(25*opacityJZ, jacksonZonesColor));
			}
			else
			{
				Plots[0].Name = "PP";
				Plots[1].Name = "R1";
				Plots[2].Name = "S1";
				Plots[3].Name = "R2";
				Plots[4].Name = "S2";
				Plots[5].Name = "R3";
				Plots[6].Name = "S3";
				Plots[7].Name = "R4";
				Plots[8].Name = "S4";
				Plots[9].Name = "R5";
				Plots[10].Name = "S5";
			}
			labelFont = new Font ("Arial", labelFontSize);
			pivotBrush = new SolidBrush(Color.FromArgb(25*opacityPR, pivotRangeColor));
			centralBrush = new SolidBrush(Color.FromArgb(25*opacityPR, centralRangeColor));
			pivotLinePen = new Pen(Color.FromArgb(Math.Min(40*opacityPR,255), pivotRangeColor),1);
			pivotLinePen.DashStyle = DashStyle.Dot;
			Plots[0].Pen.Color = pivotColor;
			Plots[1].Pen.Color = resistanceColor;
			Plots[2].Pen.Color = supportColor;
			Plots[3].Pen.Color = resistanceColor;
			Plots[4].Pen.Color = supportColor;
			Plots[5].Pen.Color = resistanceColor;
			Plots[6].Pen.Color = supportColor;
			Plots[7].Pen.Color = resistanceColor;
			Plots[8].Pen.Color = supportColor;
			Plots[9].Pen.Color = resistanceColor;
			Plots[10].Pen.Color = supportColor;
			Plots[11].Pen.Color = midpivotColor;
			Plots[12].Pen.Color = midpivotColor;
			Plots[13].Pen.Color = midpivotColor;
			Plots[14].Pen.Color = midpivotColor;
			Plots[15].Pen.Color = midpivotColor;
			Plots[16].Pen.Color = midpivotColor;
			Plots[17].Pen.Color = midpivotColor;
			Plots[18].Pen.Color = midpivotColor;
			Plots[19].Pen.Color = midpivotColor;
			Plots[20].Pen.Color = midpivotColor;
			Plots[21].Pen.Color = highColor;
			Plots[22].Pen.Color = lowColor;
			Plots[23].Pen.Color = closeColor;
			Plots[24].Pen.Color = centralPivotColor;
			Plots[25].Pen.Color = directionalPivotColor;
			Plots[26].Pen.Color = vwapColor;
			
			for (int i = 0; i < 11; i++)
			{
				Plots[i].Pen.Width = plot0Width;
				Plots[i].Pen.DashStyle = dash0Style;
			}
			for (int i = 11; i < 21; i++)
			{
				Plots[i].Pen.Width = plot1Width;
				Plots[i].Pen.DashStyle = dash1Style;
			}
			for (int i = 21; i < 24; i++)
			{
				Plots[i].Pen.Width = plot2Width;
				Plots[i].Pen.DashStyle = dash2Style;
			}			
			for (int i = 24; i < 27; i++)
			{
				Plots[i].Pen.Width = plot0Width;
				Plots[i].Pen.DashStyle = dash0Style;
			}			
			if(ChartControl != null)
				errorBrush.Color = ChartControl.AxisColor;
			if (Instrument.MasterInstrument.InstrumentType == Cbi.InstrumentType.Currency && (TickSize == 0.00001 || TickSize == 0.001))
				displaySize = 5* TickSize;
			else
				displaySize = TickSize;
			if (AutoScale)
				AutoScale = false;
			if (!Bars.BarsType.IsIntraday || BarsPeriod.Id == PeriodType.Minute || BarsPeriod.Id == PeriodType.Second)
				tickBuilt = false;
			else
				tickBuilt = true;
			existsHistDailyData = false;
			if(selectedSession == anaSessionTypePD43.DailyBars || selectedSession == anaSessionTypePD43.UserDefined)
				countDown = 0;
			else
				countDown = 1;
		}
 public Indicator.anaPivotsDailyV43 anaPivotsDailyV43(anaSessionCountPD43 activeSession, anaCalcModePD43 calcMode, anaPivotStylesPD43 pivotFormula, anaSessionTypePD43 pivotSession, bool showMidpivots, bool showPriorPeriods, double userDefinedClose, double userDefinedHigh, double userDefinedLow)
 {
     return _indicator.anaPivotsDailyV43(Input, activeSession, calcMode, pivotFormula, pivotSession, showMidpivots, showPriorPeriods, userDefinedClose, userDefinedHigh, userDefinedLow);
 }
        /// <summary>
        /// Daily Session Pivots.
        /// </summary>
        /// <returns></returns>
        public anaPivotsDailyV43 anaPivotsDailyV43(Data.IDataSeries input, anaSessionCountPD43 activeSession, anaCalcModePD43 calcMode, anaPivotStylesPD43 pivotFormula, anaSessionTypePD43 pivotSession, bool showMidpivots, bool showPriorPeriods, double userDefinedClose, double userDefinedHigh, double userDefinedLow)
        {
            if (cacheanaPivotsDailyV43 != null)
                for (int idx = 0; idx < cacheanaPivotsDailyV43.Length; idx++)
                    if (cacheanaPivotsDailyV43[idx].ActiveSession == activeSession && cacheanaPivotsDailyV43[idx].CalcMode == calcMode && cacheanaPivotsDailyV43[idx].PivotFormula == pivotFormula && cacheanaPivotsDailyV43[idx].PivotSession == pivotSession && cacheanaPivotsDailyV43[idx].ShowMidpivots == showMidpivots && cacheanaPivotsDailyV43[idx].ShowPriorPeriods == showPriorPeriods && Math.Abs(cacheanaPivotsDailyV43[idx].UserDefinedClose - userDefinedClose) <= double.Epsilon && Math.Abs(cacheanaPivotsDailyV43[idx].UserDefinedHigh - userDefinedHigh) <= double.Epsilon && Math.Abs(cacheanaPivotsDailyV43[idx].UserDefinedLow - userDefinedLow) <= double.Epsilon && cacheanaPivotsDailyV43[idx].EqualsInput(input))
                        return cacheanaPivotsDailyV43[idx];

            lock (checkanaPivotsDailyV43)
            {
                checkanaPivotsDailyV43.ActiveSession = activeSession;
                activeSession = checkanaPivotsDailyV43.ActiveSession;
                checkanaPivotsDailyV43.CalcMode = calcMode;
                calcMode = checkanaPivotsDailyV43.CalcMode;
                checkanaPivotsDailyV43.PivotFormula = pivotFormula;
                pivotFormula = checkanaPivotsDailyV43.PivotFormula;
                checkanaPivotsDailyV43.PivotSession = pivotSession;
                pivotSession = checkanaPivotsDailyV43.PivotSession;
                checkanaPivotsDailyV43.ShowMidpivots = showMidpivots;
                showMidpivots = checkanaPivotsDailyV43.ShowMidpivots;
                checkanaPivotsDailyV43.ShowPriorPeriods = showPriorPeriods;
                showPriorPeriods = checkanaPivotsDailyV43.ShowPriorPeriods;
                checkanaPivotsDailyV43.UserDefinedClose = userDefinedClose;
                userDefinedClose = checkanaPivotsDailyV43.UserDefinedClose;
                checkanaPivotsDailyV43.UserDefinedHigh = userDefinedHigh;
                userDefinedHigh = checkanaPivotsDailyV43.UserDefinedHigh;
                checkanaPivotsDailyV43.UserDefinedLow = userDefinedLow;
                userDefinedLow = checkanaPivotsDailyV43.UserDefinedLow;

                if (cacheanaPivotsDailyV43 != null)
                    for (int idx = 0; idx < cacheanaPivotsDailyV43.Length; idx++)
                        if (cacheanaPivotsDailyV43[idx].ActiveSession == activeSession && cacheanaPivotsDailyV43[idx].CalcMode == calcMode && cacheanaPivotsDailyV43[idx].PivotFormula == pivotFormula && cacheanaPivotsDailyV43[idx].PivotSession == pivotSession && cacheanaPivotsDailyV43[idx].ShowMidpivots == showMidpivots && cacheanaPivotsDailyV43[idx].ShowPriorPeriods == showPriorPeriods && Math.Abs(cacheanaPivotsDailyV43[idx].UserDefinedClose - userDefinedClose) <= double.Epsilon && Math.Abs(cacheanaPivotsDailyV43[idx].UserDefinedHigh - userDefinedHigh) <= double.Epsilon && Math.Abs(cacheanaPivotsDailyV43[idx].UserDefinedLow - userDefinedLow) <= double.Epsilon && cacheanaPivotsDailyV43[idx].EqualsInput(input))
                            return cacheanaPivotsDailyV43[idx];

                anaPivotsDailyV43 indicator = new anaPivotsDailyV43();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.ActiveSession = activeSession;
                indicator.CalcMode = calcMode;
                indicator.PivotFormula = pivotFormula;
                indicator.PivotSession = pivotSession;
                indicator.ShowMidpivots = showMidpivots;
                indicator.ShowPriorPeriods = showPriorPeriods;
                indicator.UserDefinedClose = userDefinedClose;
                indicator.UserDefinedHigh = userDefinedHigh;
                indicator.UserDefinedLow = userDefinedLow;
                Indicators.Add(indicator);
                indicator.SetUp();

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