/// <summary> /// anaCurrentDayOHLV43. /// </summary> /// <returns></returns> public Indicator.anaCurrentDayOHLV43 anaCurrentDayOHLV43(Data.IDataSeries input, anaSessionTypeCD43 currentSession, int factorDailyRange, int factorNoiseBands, bool includeAfterSession, int rangePeriod1, int rangePeriod2, anaSessionCountCD43 selectedSession, bool showCurrentClose, bool showCurrentOpen, bool showFibonacci, bool showHiLo, bool showMidline, bool showNoiseLevels, bool showTargetLevels, anaTargetTypeCD43 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.anaCurrentDayOHLV43(input, currentSession, factorDailyRange, factorNoiseBands, includeAfterSession, rangePeriod1, rangePeriod2, selectedSession, showCurrentClose, showCurrentOpen, showFibonacci, showHiLo, showMidline, showNoiseLevels, showTargetLevels, targetType); }
/// <summary> /// anaCurrentDayOHLV43. /// </summary> /// <returns></returns> public anaCurrentDayOHLV43 anaCurrentDayOHLV43(Data.IDataSeries input, anaSessionTypeCD43 currentSession, int factorDailyRange, int factorNoiseBands, bool includeAfterSession, int rangePeriod1, int rangePeriod2, anaSessionCountCD43 selectedSession, bool showCurrentClose, bool showCurrentOpen, bool showFibonacci, bool showHiLo, bool showMidline, bool showNoiseLevels, bool showTargetLevels, anaTargetTypeCD43 targetType) { if (cacheanaCurrentDayOHLV43 != null) for (int idx = 0; idx < cacheanaCurrentDayOHLV43.Length; idx++) if (cacheanaCurrentDayOHLV43[idx].CurrentSession == currentSession && cacheanaCurrentDayOHLV43[idx].FactorDailyRange == factorDailyRange && cacheanaCurrentDayOHLV43[idx].FactorNoiseBands == factorNoiseBands && cacheanaCurrentDayOHLV43[idx].IncludeAfterSession == includeAfterSession && cacheanaCurrentDayOHLV43[idx].RangePeriod1 == rangePeriod1 && cacheanaCurrentDayOHLV43[idx].RangePeriod2 == rangePeriod2 && cacheanaCurrentDayOHLV43[idx].SelectedSession == selectedSession && cacheanaCurrentDayOHLV43[idx].ShowCurrentClose == showCurrentClose && cacheanaCurrentDayOHLV43[idx].ShowCurrentOpen == showCurrentOpen && cacheanaCurrentDayOHLV43[idx].ShowFibonacci == showFibonacci && cacheanaCurrentDayOHLV43[idx].ShowHiLo == showHiLo && cacheanaCurrentDayOHLV43[idx].ShowMidline == showMidline && cacheanaCurrentDayOHLV43[idx].ShowNoiseLevels == showNoiseLevels && cacheanaCurrentDayOHLV43[idx].ShowTargetLevels == showTargetLevels && cacheanaCurrentDayOHLV43[idx].TargetType == targetType && cacheanaCurrentDayOHLV43[idx].EqualsInput(input)) return cacheanaCurrentDayOHLV43[idx]; lock (checkanaCurrentDayOHLV43) { checkanaCurrentDayOHLV43.CurrentSession = currentSession; currentSession = checkanaCurrentDayOHLV43.CurrentSession; checkanaCurrentDayOHLV43.FactorDailyRange = factorDailyRange; factorDailyRange = checkanaCurrentDayOHLV43.FactorDailyRange; checkanaCurrentDayOHLV43.FactorNoiseBands = factorNoiseBands; factorNoiseBands = checkanaCurrentDayOHLV43.FactorNoiseBands; checkanaCurrentDayOHLV43.IncludeAfterSession = includeAfterSession; includeAfterSession = checkanaCurrentDayOHLV43.IncludeAfterSession; checkanaCurrentDayOHLV43.RangePeriod1 = rangePeriod1; rangePeriod1 = checkanaCurrentDayOHLV43.RangePeriod1; checkanaCurrentDayOHLV43.RangePeriod2 = rangePeriod2; rangePeriod2 = checkanaCurrentDayOHLV43.RangePeriod2; checkanaCurrentDayOHLV43.SelectedSession = selectedSession; selectedSession = checkanaCurrentDayOHLV43.SelectedSession; checkanaCurrentDayOHLV43.ShowCurrentClose = showCurrentClose; showCurrentClose = checkanaCurrentDayOHLV43.ShowCurrentClose; checkanaCurrentDayOHLV43.ShowCurrentOpen = showCurrentOpen; showCurrentOpen = checkanaCurrentDayOHLV43.ShowCurrentOpen; checkanaCurrentDayOHLV43.ShowFibonacci = showFibonacci; showFibonacci = checkanaCurrentDayOHLV43.ShowFibonacci; checkanaCurrentDayOHLV43.ShowHiLo = showHiLo; showHiLo = checkanaCurrentDayOHLV43.ShowHiLo; checkanaCurrentDayOHLV43.ShowMidline = showMidline; showMidline = checkanaCurrentDayOHLV43.ShowMidline; checkanaCurrentDayOHLV43.ShowNoiseLevels = showNoiseLevels; showNoiseLevels = checkanaCurrentDayOHLV43.ShowNoiseLevels; checkanaCurrentDayOHLV43.ShowTargetLevels = showTargetLevels; showTargetLevels = checkanaCurrentDayOHLV43.ShowTargetLevels; checkanaCurrentDayOHLV43.TargetType = targetType; targetType = checkanaCurrentDayOHLV43.TargetType; if (cacheanaCurrentDayOHLV43 != null) for (int idx = 0; idx < cacheanaCurrentDayOHLV43.Length; idx++) if (cacheanaCurrentDayOHLV43[idx].CurrentSession == currentSession && cacheanaCurrentDayOHLV43[idx].FactorDailyRange == factorDailyRange && cacheanaCurrentDayOHLV43[idx].FactorNoiseBands == factorNoiseBands && cacheanaCurrentDayOHLV43[idx].IncludeAfterSession == includeAfterSession && cacheanaCurrentDayOHLV43[idx].RangePeriod1 == rangePeriod1 && cacheanaCurrentDayOHLV43[idx].RangePeriod2 == rangePeriod2 && cacheanaCurrentDayOHLV43[idx].SelectedSession == selectedSession && cacheanaCurrentDayOHLV43[idx].ShowCurrentClose == showCurrentClose && cacheanaCurrentDayOHLV43[idx].ShowCurrentOpen == showCurrentOpen && cacheanaCurrentDayOHLV43[idx].ShowFibonacci == showFibonacci && cacheanaCurrentDayOHLV43[idx].ShowHiLo == showHiLo && cacheanaCurrentDayOHLV43[idx].ShowMidline == showMidline && cacheanaCurrentDayOHLV43[idx].ShowNoiseLevels == showNoiseLevels && cacheanaCurrentDayOHLV43[idx].ShowTargetLevels == showTargetLevels && cacheanaCurrentDayOHLV43[idx].TargetType == targetType && cacheanaCurrentDayOHLV43[idx].EqualsInput(input)) return cacheanaCurrentDayOHLV43[idx]; anaCurrentDayOHLV43 indicator = new anaCurrentDayOHLV43(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.CurrentSession = currentSession; indicator.FactorDailyRange = factorDailyRange; indicator.FactorNoiseBands = factorNoiseBands; indicator.IncludeAfterSession = includeAfterSession; indicator.RangePeriod1 = rangePeriod1; indicator.RangePeriod2 = rangePeriod2; indicator.SelectedSession = selectedSession; indicator.ShowCurrentClose = showCurrentClose; 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(); anaCurrentDayOHLV43[] tmp = new anaCurrentDayOHLV43[cacheanaCurrentDayOHLV43 == null ? 1 : cacheanaCurrentDayOHLV43.Length + 1]; if (cacheanaCurrentDayOHLV43 != null) cacheanaCurrentDayOHLV43.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cacheanaCurrentDayOHLV43 = tmp; return indicator; } }
public Indicator.anaCurrentDayOHLV43 anaCurrentDayOHLV43(anaSessionTypeCD43 currentSession, int factorDailyRange, int factorNoiseBands, bool includeAfterSession, int rangePeriod1, int rangePeriod2, anaSessionCountCD43 selectedSession, bool showCurrentClose, bool showCurrentOpen, bool showFibonacci, bool showHiLo, bool showMidline, bool showNoiseLevels, bool showTargetLevels, anaTargetTypeCD43 targetType) { return _indicator.anaCurrentDayOHLV43(Input, currentSession, factorDailyRange, factorNoiseBands, includeAfterSession, rangePeriod1, rangePeriod2, selectedSession, showCurrentClose, 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; 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; 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 == anaSessionCountCD43.Auto) { if (isCurrency) activeSession = anaSessionCountCD43.Third; else activeSession = anaSessionCountCD43.Second; } else activeSession = selectedSession; if(showRangeData == anaDataLocationCD43.Left_Format_Long || showRangeData == anaDataLocationCD43.Right_Format_Long || showRangeData == anaDataLocationCD43.Center_Format_Long) { if (currentSession == anaSessionTypeCD43.ETH) { if(targetType== anaTargetTypeCD43.Average_Daily_Range) { rangeText0 = "Current Daily Range ETH = "; rangeText1 = "Average Daily Range [" + rangePeriod1 + "] = "; rangeText2 = "Average Daily Range [" + rangePeriod2 + "] = "; } else { rangeText0 = "Current Daily Expansion ETH = "; rangeText1 = "Average Daily Expansion [" + rangePeriod1 + "] = "; rangeText2 = "Average Daily Expansion [" + rangePeriod2 + "] = "; } noiseText0 = "Current Daily Noise ETH = "; noiseText1 = "Average Daily Noise [" + rangePeriod1 + "] = "; noiseText2 = "Average Daily Noise [" + rangePeriod2 + "] = "; rthOHL = false; } else { if(targetType== anaTargetTypeCD43.Average_Daily_Range) { rangeText0 = "Current Daily Range RTH = "; rangeText1 = "Average Daily Range [" + rangePeriod1 + "] = "; rangeText2 = "Average Daily Range [" + rangePeriod2 + "] = "; } else { rangeText0 = "Current Daily Expansion RTH = "; rangeText1 = "Average Daily Expansion [" + rangePeriod1 + "] = "; rangeText2 = "Average Daily Expansion [" + rangePeriod2 + "] = "; } noiseText0 = "Current Daily Noise RTH = "; noiseText1 = "Average Daily Noise [" + rangePeriod1 + "] = "; noiseText2 = "Average Daily Noise [" + rangePeriod2 + "] = "; rthOHL = true; } } else if(showRangeData == anaDataLocationCD43.Left_Format_Short || showRangeData == anaDataLocationCD43.Right_Format_Short || showRangeData == anaDataLocationCD43.Center_Format_Short) { if (currentSession == anaSessionTypeCD43.ETH) { if(targetType== anaTargetTypeCD43.Average_Daily_Range) { rangeText0 = "CDR ETH = "; rangeText1 = "ADR [" + rangePeriod1 + "] = "; rangeText2 = "ADR [" + rangePeriod2 + "] = "; } else { rangeText0 = "CDE ETH = "; rangeText1 = "ADE [" + rangePeriod1 + "] = "; rangeText2 = "ADE [" + rangePeriod2 + "] = "; } noiseText0 = "CDN ETH = "; noiseText1 = "ADN [" + rangePeriod1 + "] = "; noiseText2 = "ADN [" + rangePeriod2 + "] = "; rthOHL = false; } else { if(targetType== anaTargetTypeCD43.Average_Daily_Range) { rangeText0 = "CDR RTH = "; rangeText1 = "ADR [" + rangePeriod1 + "] = "; rangeText2 = "ADR [" + rangePeriod2 + "] = "; } else { rangeText0 = "CDE RTH = "; rangeText1 = "ADE [" + rangePeriod1 + "] = "; rangeText2 = "ADE [" + rangePeriod2 + "] = "; } noiseText0 = "CDN RTH = "; noiseText1 = "ADN [" + rangePeriod1 + "] = "; noiseText2 = "ADN [" + rangePeriod2 + "] = "; rthOHL = true; } } else { if (currentSession == anaSessionTypeCD43.ETH) rthOHL = false; else rthOHL = true; } if(targetType == anaTargetTypeCD43.Average_Daily_Range) { Plots[11].Name = "ADR-High"; Plots[12].Name = "ADR-Low"; } else { Plots[11].Name = "ADE-High"; Plots[12].Name = "ADE-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 (!showCurrentClose || closeColor == Color.Transparent) plotCurrentClose = false; else plotCurrentClose = 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(showCurrentClose) Plots[8].Pen.Color = closeColor; else Plots[8].Pen.Color = Color.Transparent; if (showNoiseLevels) { Plots[9].Pen.Color = noiseBandColor; Plots[10].Pen.Color = noiseBandColor; } else { Plots[9].Pen.Color = Color.Transparent; Plots[10].Pen.Color = Color.Transparent; } if(showTargetLevels) { Plots[11].Pen.Color = targetBandColor; Plots[12].Pen.Color = targetBandColor; } else { Plots[11].Pen.Color = Color.Transparent; Plots[12].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 < 9; i++) { Plots[i].Pen.Width = plot3Width; Plots[i].Pen.DashStyle = dash3Style; } for (int i = 9; i< 13; 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 + 2) + 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; dayCount = 0; }