Ejemplo n.º 1
0
		/// <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;
			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 == anaSessionTypePW43.Auto && isCurrency)
				selectedSession = anaSessionTypePW43.ETH;
			else if(pivotSession == anaSessionTypePW43.Auto)
				selectedSession = anaSessionTypePW43.RTH;
			else
				selectedSession = pivotSession;
			labelFont = new Font ("Arial", labelFontSize);
			if (PivotFormula == anaPivotStylesPW43.Jackson)
			{
				Plots[0].Name = "W-PP";
				Plots[1].Name = "W-R1";
				Plots[2].Name = "W-S1";
				Plots[3].Name = "W-RB1";
				Plots[4].Name = "W-SB1";
				Plots[5].Name = "W-R2";
				Plots[6].Name = "W-S2";
				Plots[7].Name = "W-RB2";
				Plots[8].Name = "W-SB2";
				Plots[9].Name = "W-R3";
				Plots[10].Name = "W-S3";
				jacksonBrush = new SolidBrush(Color.FromArgb(25*opacityJZ, jacksonZonesColor));
			}
			else
			{
				Plots[0].Name = "W-PP";
				Plots[1].Name = "W-R1";
				Plots[2].Name = "W-S1";
				Plots[3].Name = "W-R2";
				Plots[4].Name = "W-S2";
				Plots[5].Name = "W-R3";
				Plots[6].Name = "W-S3";
				Plots[7].Name = "W-R4";
				Plots[8].Name = "W-S4";
				Plots[9].Name = "W-R5";
				Plots[10].Name = "W-S5";
			}
			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;
			countDown = 1;
		}
Ejemplo n.º 2
0
 public Indicator.anaPivotsWeeklyV43 anaPivotsWeeklyV43(anaSessionCountPW43 activeSession, anaCalcModePW43 calcMode, anaPivotStylesPW43 pivotFormula, anaSessionTypePW43 pivotSession, bool showMidpivots, bool showPriorPeriods, double userDefinedClose, double userDefinedHigh, double userDefinedLow)
 {
     return _indicator.anaPivotsWeeklyV43(Input, activeSession, calcMode, pivotFormula, pivotSession, showMidpivots, showPriorPeriods, userDefinedClose, userDefinedHigh, userDefinedLow);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Weekly Session Pivots.
        /// </summary>
        /// <returns></returns>
        public Indicator.anaPivotsWeeklyV43 anaPivotsWeeklyV43(Data.IDataSeries input, anaSessionCountPW43 activeSession, anaCalcModePW43 calcMode, anaPivotStylesPW43 pivotFormula, anaSessionTypePW43 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.anaPivotsWeeklyV43(input, activeSession, calcMode, pivotFormula, pivotSession, showMidpivots, showPriorPeriods, userDefinedClose, userDefinedHigh, userDefinedLow);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Weekly Session Pivots.
        /// </summary>
        /// <returns></returns>
        public anaPivotsWeeklyV43 anaPivotsWeeklyV43(Data.IDataSeries input, anaSessionCountPW43 activeSession, anaCalcModePW43 calcMode, anaPivotStylesPW43 pivotFormula, anaSessionTypePW43 pivotSession, bool showMidpivots, bool showPriorPeriods, double userDefinedClose, double userDefinedHigh, double userDefinedLow)
        {
            if (cacheanaPivotsWeeklyV43 != null)
                for (int idx = 0; idx < cacheanaPivotsWeeklyV43.Length; idx++)
                    if (cacheanaPivotsWeeklyV43[idx].ActiveSession == activeSession && cacheanaPivotsWeeklyV43[idx].CalcMode == calcMode && cacheanaPivotsWeeklyV43[idx].PivotFormula == pivotFormula && cacheanaPivotsWeeklyV43[idx].PivotSession == pivotSession && cacheanaPivotsWeeklyV43[idx].ShowMidpivots == showMidpivots && cacheanaPivotsWeeklyV43[idx].ShowPriorPeriods == showPriorPeriods && Math.Abs(cacheanaPivotsWeeklyV43[idx].UserDefinedClose - userDefinedClose) <= double.Epsilon && Math.Abs(cacheanaPivotsWeeklyV43[idx].UserDefinedHigh - userDefinedHigh) <= double.Epsilon && Math.Abs(cacheanaPivotsWeeklyV43[idx].UserDefinedLow - userDefinedLow) <= double.Epsilon && cacheanaPivotsWeeklyV43[idx].EqualsInput(input))
                        return cacheanaPivotsWeeklyV43[idx];

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

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

                anaPivotsWeeklyV43 indicator = new anaPivotsWeeklyV43();
                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();

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