From 4e2f0feb33d12f21b90943cbe7030f3ea460e17e Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Sat, 23 Aug 2025 11:53:24 +0330 Subject: [PATCH] last works on xom1 ... --- Indicators/x-saherelm.xom1.mq5 | 914 +++++++++++++++++++++++++++++++-- 1 file changed, 861 insertions(+), 53 deletions(-) diff --git a/Indicators/x-saherelm.xom1.mq5 b/Indicators/x-saherelm.xom1.mq5 index cc578578..cac422de 100644 --- a/Indicators/x-saherelm.xom1.mq5 +++ b/Indicators/x-saherelm.xom1.mq5 @@ -36,10 +36,40 @@ // input group "Calculation"; + +// +// Short ... +input ENUM_X_PERIOD_METHOD scMethod = X_PERIOD_AUTO; // How to Find Short Period +input ENUM_TIMEFRAMES scPeriod = NULL; // Short Period + +// +// Medium ... +input ENUM_X_PERIOD_METHOD mcMethod = X_PERIOD_AUTO; // How to Find Medium Period +input ENUM_TIMEFRAMES mcPeriod = NULL; // Medium Period + +// +// Long ... +input ENUM_X_PERIOD_METHOD lcMethod = X_PERIOD_AUTO; // How to Find Long Period +input ENUM_TIMEFRAMES lcPeriod = NULL; // Long Period + +// +// Hind ... +input ENUM_X_PERIOD_METHOD hcMethod = X_PERIOD_AUTO; // How to Find Hind Period +input ENUM_TIMEFRAMES hcPeriod = NULL; // Hind Period + +// +// PV ... +input ENUM_SERIESMODE upperMode = MODE_HIGH; // Peak Method +input ENUM_SERIESMODE lowerMode = MODE_LOW; // Vale Method + +// +// Others ... input ENUM_TIMEFRAMES obPeriod = PERIOD_H1; // Order Block Detection Period input ENUM_TIMEFRAMES fvgPeriod = PERIOD_M15; // Fair Value Gap Detection Period input ENUM_X_FIBO_LEVELS upperZoneLevel = X_FIBO_LEVEL_618; // Upper Zone Level input ENUM_X_FIBO_LEVELS lowerZoneLevel = X_FIBO_LEVEL_764; // Lower Zone Level +input double sarStep = 0.02; // SAR Step +input double sarMax = 0.2; // SAR Maximum input ENUM_MA_METHOD maMethod = MODE_EMA; // MA Method input ENUM_APPLIED_PRICE maAppliedTo = PRICE_CLOSE; // MA Applied To input int maLength = 10; // MA Length @@ -47,11 +77,19 @@ input int maLength = 10; // MA Length // // Presentation ... input group "Presentation"; -// input bool showBars = true; // Show Bars +input bool showPV = true; // Show PV +input bool showMA = true; // Show MA +input bool showSAR = true; // Show Sar +input bool showFiboZone = true; // Show Fibo Zone // input int startCalculationForLastBars = 1500; // Calculate Last n Bars +// +input int sarArrowCode = 159; // Parabolic Sar Arrow Code +input int peakArrowCode = 159; // Peaks Arrow Code +input int valeArrowCode = 159; // Vales Arrow Code + // // Non Inputs ... @@ -76,21 +114,198 @@ input int startCalculationForLastBars = 1500; // Calculate Last n Bars #property indicator_chart_window // -#property indicator_buffers 0 -#property indicator_plots 0 +#property indicator_buffers 20 +#property indicator_plots 6 // // Plot Buffers ... +// +// MA ... + +// +#define maBufferIndex 0 +#define maBufferPlotIndex 0 +double maBuffer[]; + +// +#define maColorBufferIndex 1 +double maColorBuffer[]; + +// +#property indicator_label1 "MA" +#property indicator_type1 DRAW_COLOR_LINE +#property indicator_color1 CLR_NONE, clrLime, clrRed, clrGray +#property indicator_width1 2 + +// +// SAR ... + +// +#define sarBufferIndex 2 +#define sarBufferPlotIndex 1 +double sarBuffer[]; + +// +#define sarColorBufferIndex 3 +double sarColorBuffer[]; + +// +#property indicator_label2 "SAR" +#property indicator_type2 DRAW_COLOR_ARROW +#property indicator_color2 CLR_NONE, clrLime, clrRed, clrGray +#property indicator_width2 2 + +// +// PEAKS ... + +// +#define peakBufferIndex 4 +#define peakBufferPlotIndex 2 +double peakBuffer[]; + +// +#property indicator_label3 "PEAK" +#property indicator_type3 DRAW_ARROW +#property indicator_color3 clrMagenta +#property indicator_width3 3 + +// +// VALES ... + +// +#define valeBufferIndex 5 +#define valeBufferPlotIndex 3 +double valeBuffer[]; + +// +#property indicator_label4 "VALE" +#property indicator_type4 DRAW_ARROW +#property indicator_color4 clrAqua +#property indicator_width4 3 + +// +// FIBO Upper ... + +// +#define fiboUpperBufferIndex 6 +#define fiboUpperBufferPlotIndex 4 +double fiboUpperBuffer[]; + +// +#property indicator_label5 "FIBUP" +#property indicator_type5 DRAW_LINE +#property indicator_color5 clrAqua +#property indicator_width5 2 + +// +// FIBO Lower ... + +// +#define fiboLowerBufferIndex 7 +#define fiboLowerBufferPlotIndex 5 +double fiboLowerBuffer[]; + +// +#property indicator_label6 "FIBLO" +#property indicator_type6 DRAW_LINE +#property indicator_color6 clrMagenta +#property indicator_width6 2 + // // Data Buffers ... // -#define mLastBufferIndex 15 +#define mLastBufferIndex 7 + +// +// MA ... + +// +#define maStateBufferIndex mLastBufferIndex + 1 +double maStateBuffer[]; + +// +// SAR ... + +// +#define sarStateBufferIndex mLastBufferIndex + 2 +double sarStateBuffer[]; + +// +// CYCLES ... + +// +// SC ... + +// +#define sHHBufferIndex mLastBufferIndex + 3 +double sHHBuffer[]; + +// +#define sLLBufferIndex mLastBufferIndex + 4 +double sLLBuffer[]; + +// +// MC ... + +// +#define mHHBufferIndex mLastBufferIndex + 5 +double mHHBuffer[]; + +// +#define mLLBufferIndex mLastBufferIndex + 6 +double mLLBuffer[]; + +// +// LC ... + +// +#define lHHBufferIndex mLastBufferIndex + 7 +double lHHBuffer[]; + +// +#define lLLBufferIndex mLastBufferIndex + 8 +double lLLBuffer[]; + +// +// HC ... + +// +#define hHHBufferIndex mLastBufferIndex + 9 +double hHHBuffer[]; + +// +#define hLLBufferIndex mLastBufferIndex + 10 +double hLLBuffer[]; // // Variables, Properties and etc ... +// +// XMarketCycle sc; +int mSCLength = 0; +ENUM_TIMEFRAMES mSCPeriod = NULL; + +// +// XMarketCycle mc; +int mMCLength = 0; +ENUM_TIMEFRAMES mMCPeriod = NULL; + +// +// XMarketCycle lc; +int mLCLength = 0; +ENUM_TIMEFRAMES mLCPeriod = NULL; + +// +// XMarketCycle hc; +int mHCLength = 0; +ENUM_TIMEFRAMES mHCPeriod = NULL; + +// +int maHandler = INVALID_HANDLE; +int sarHandler = INVALID_HANDLE; + // int limit; @@ -126,6 +341,13 @@ int OnInit() return INIT_PARAMETERS_INCORRECT; } + // + has = InitCycles(); + if (!has) + { + return INIT_FAILED; + } + // // because in some cases we may have more than one input for // calculation and we must prevent any calculation @@ -184,7 +406,8 @@ void OnDeinit(const int reason) // // De Initialize all Handlers and etc ... - // IndicatorRelease(scMaHandler); + IndicatorRelease(maHandler); + IndicatorRelease(sarHandler); } /** @@ -231,43 +454,59 @@ int OnCalculate( // Validate Calculated Bars ... // - // int scCalculatedBars = BarsCalculated(scMaHandler); + // MA ... + int maCalculatedBars = BarsCalculated(maHandler); - // // - // bool isPassedRequiredCalculatedBars = - // // - // // SC ... - // scCalculatedBars >= maxLength - // // - // ; - // if (!isPassedRequiredCalculatedBars) - // { - // return prev_calculated; - // } + // + // SAR ... + int sarCalculatedBars = BarsCalculated(sarHandler); - // // - // limit = (prev_calculated > rates_total || prev_calculated <= 0) - // ? rates_total - // : (rates_total - prev_calculated) + 1; + // + bool isPassedRequiredCalculatedBars = + // + // MA ... + maCalculatedBars >= maxLength && + // + // SAR ... + sarCalculatedBars >= maxLength + // + ; + if (!isPassedRequiredCalculatedBars) + { + return prev_calculated; + } + + // + limit = (prev_calculated > rates_total || prev_calculated <= 0) + ? rates_total + : (rates_total - prev_calculated) + 1; // // Buffers Copy ... - // // - // int copiedSCs = CopyBuffer(scMaHandler, MAIN_LINE, 0, limit, scMaBuffer); + // + // MA ... + int copiedMAs = CopyBuffer(maHandler, MAIN_LINE, 0, limit, maBuffer); - // // - // // Validate Copied Items ... - // bool isPassedRequiredCopiedItems = - // // - // // SC ... - // copiedSCs >= limit - // // - // ; - // if (!isPassedRequiredCopiedItems) - // { - // return prev_calculated; - // } + // + // SAR ... + int copiedSARs = CopyBuffer(sarHandler, MAIN_LINE, 0, limit, sarBuffer); + + // + // Validate Copied Items ... + bool isPassedRequiredCopiedItems = + // + // MA ... + copiedMAs >= limit && + // + // SAR ... + copiedSARs >= limit + // + ; + if (!isPassedRequiredCopiedItems) + { + return prev_calculated; + } // // Main Loop ... @@ -317,7 +556,19 @@ bool ValidateInputs() // result = // - false + // MA ... + maLength >= 2 && + // + // SAR ... + sarMax > 0 && + sarStep > 0 && + sarMax > sarStep && + // + // CYCLES ... + (IsValid(scMethod, scPeriod) && + IsValid(mcMethod, mcPeriod) && + IsValid(lcMethod, lcPeriod) && + IsValid(hcMethod, hcPeriod)) // ; @@ -336,7 +587,10 @@ int ExtractMaxLengthOfInputs() int result = 0; // - result = MathMax(result, 0); + result = MathMax(mSCLength, mMCLength); + result = MathMax(result, mLCLength); + result = MathMax(result, mHCLength); + result = MathMax(result, maLength); // return result; @@ -348,12 +602,268 @@ int ExtractMaxLengthOfInputs() void DefineBuffers() { // - // Plot Buffers ... + // MA ... + + // + ArraySetAsSeries(maBuffer, true); + SetIndexBuffer(maBufferIndex, maBuffer, INDICATOR_DATA); + + // + PlotIndexSetInteger(maBufferPlotIndex, PLOT_SHOW_DATA, showMA); + PlotIndexSetDouble(maBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue); + + // + ArraySetAsSeries(maColorBuffer, true); + SetIndexBuffer(maColorBufferIndex, maColorBuffer, INDICATOR_COLOR_INDEX); + + // + ArraySetAsSeries(maStateBuffer, true); + SetIndexBuffer(maStateBufferIndex, maStateBuffer, INDICATOR_CALCULATIONS); + + // + // SAR ... + + // + ArraySetAsSeries(sarBuffer, true); + SetIndexBuffer(sarBufferIndex, sarBuffer, INDICATOR_DATA); + + // + PlotIndexSetInteger(sarBufferPlotIndex, PLOT_SHOW_DATA, showSAR); + PlotIndexSetDouble(sarBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue); + PlotIndexSetInteger(sarBufferPlotIndex, PLOT_ARROW, sarArrowCode); + + // + ArraySetAsSeries(sarColorBuffer, true); + SetIndexBuffer(sarColorBufferIndex, sarColorBuffer, INDICATOR_COLOR_INDEX); + + // + ArraySetAsSeries(sarStateBuffer, true); + SetIndexBuffer(sarStateBufferIndex, sarStateBuffer, INDICATOR_CALCULATIONS); + + // + // PEAK / VALE ... + + // + ENUM_DRAW_TYPE pvDrawType = showPV ? DRAW_ARROW : DRAW_NONE; + + // + // PEAK ... + + // + ArraySetAsSeries(peakBuffer, true); + SetIndexBuffer(peakBufferIndex, peakBuffer, INDICATOR_DATA); + + // + PlotIndexSetInteger(peakBufferPlotIndex, PLOT_SHOW_DATA, showPV); + PlotIndexSetInteger(peakBufferPlotIndex, PLOT_DRAW_TYPE, pvDrawType); + + // + PlotIndexSetDouble(peakBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue); + PlotIndexSetInteger(peakBufferPlotIndex, PLOT_ARROW, peakArrowCode); + + // + // VALE ... + + // + ArraySetAsSeries(valeBuffer, true); + SetIndexBuffer(valeBufferIndex, valeBuffer, INDICATOR_DATA); + + // + PlotIndexSetInteger(valeBufferPlotIndex, PLOT_SHOW_DATA, showPV); + PlotIndexSetInteger(valeBufferPlotIndex, PLOT_DRAW_TYPE, pvDrawType); + + // + PlotIndexSetDouble(valeBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue); + PlotIndexSetInteger(valeBufferPlotIndex, PLOT_ARROW, valeArrowCode); + + // + // FIBO Zone ... + + // + ENUM_DRAW_TYPE fiboZoneDrawType = showFiboZone ? DRAW_LINE : DRAW_NONE; + + // + // Upper ... + ArraySetAsSeries(fiboUpperBuffer, true); + SetIndexBuffer(fiboUpperBufferIndex, fiboUpperBuffer, INDICATOR_DATA); + + // + PlotIndexSetInteger(fiboUpperBufferPlotIndex, PLOT_SHOW_DATA, showFiboZone); + PlotIndexSetInteger(fiboUpperBufferPlotIndex, PLOT_DRAW_TYPE, fiboZoneDrawType); + PlotIndexSetDouble(fiboUpperBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue); + + // + // Lower ... + ArraySetAsSeries(fiboLowerBuffer, true); + SetIndexBuffer(fiboLowerBufferIndex, fiboLowerBuffer, INDICATOR_DATA); + + // + PlotIndexSetInteger(fiboLowerBufferPlotIndex, PLOT_SHOW_DATA, showFiboZone); + PlotIndexSetInteger(fiboLowerBufferPlotIndex, PLOT_DRAW_TYPE, fiboZoneDrawType); + PlotIndexSetDouble(fiboLowerBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue); // // Data Buffers ... // + // CYCLES ... + + // + // SC ... + + // + ArraySetAsSeries(sHHBuffer, true); + SetIndexBuffer(sHHBufferIndex, sHHBuffer, INDICATOR_DATA); + + // + ArraySetAsSeries(sLLBuffer, true); + SetIndexBuffer(sLLBufferIndex, sLLBuffer, INDICATOR_DATA); + + // + // MC ... + + // + ArraySetAsSeries(mHHBuffer, true); + SetIndexBuffer(mHHBufferIndex, mHHBuffer, INDICATOR_DATA); + + // + ArraySetAsSeries(mLLBuffer, true); + SetIndexBuffer(mLLBufferIndex, mLLBuffer, INDICATOR_DATA); + + // + // LC ... + + // + ArraySetAsSeries(lHHBuffer, true); + SetIndexBuffer(lHHBufferIndex, lHHBuffer, INDICATOR_DATA); + + // + ArraySetAsSeries(lLLBuffer, true); + SetIndexBuffer(lLLBufferIndex, lLLBuffer, INDICATOR_DATA); + + // + // HC ... + + // + ArraySetAsSeries(hHHBuffer, true); + SetIndexBuffer(hHHBufferIndex, hHHBuffer, INDICATOR_DATA); + + // + ArraySetAsSeries(hLLBuffer, true); + SetIndexBuffer(hLLBufferIndex, hLLBuffer, INDICATOR_DATA); + + // +} + +/** + * Initial Market Cycles ... + * + * @return ( bool ) + */ +bool InitCycles() +{ + // + bool result = false; + + // + int cPeriodSeconds = PeriodSeconds(_Period); + + // + // Find Cycle Period ... + if (scMethod == X_PERIOD_AUTO) + { + // + // Select Period ... + mSCPeriod = GetCyclePeriod( + X_MARKET_CYCLE_SHORT, + _Period // + ); + } + else + { + mSCPeriod = scPeriod; + } + + // + if (IsValid(mSCPeriod)) + { + mSCLength = PeriodSeconds(mSCPeriod) / cPeriodSeconds; + } + + // + // Find Cycle Period ... + if (mcMethod == X_PERIOD_AUTO) + { + // + // Select Period ... + mMCPeriod = GetCyclePeriod( + X_MARKET_CYCLE_MEDIUM, + _Period // + ); + } + else + { + mMCPeriod = mcPeriod; + } + + // + if (IsValid(mMCPeriod)) + { + mMCLength = PeriodSeconds(mMCPeriod) / cPeriodSeconds; + } + + // + // Find Cycle Period ... + if (lcMethod == X_PERIOD_AUTO) + { + // + // Select Period ... + mLCPeriod = GetCyclePeriod( + X_MARKET_CYCLE_LONG, + _Period // + ); + } + else + { + mLCPeriod = lcPeriod; + } + + // + if (IsValid(mLCPeriod)) + { + mLCLength = PeriodSeconds(mLCPeriod) / cPeriodSeconds; + } + + // + // Find Cycle Period ... + if (hcMethod == X_PERIOD_AUTO) + { + // + // Select Period ... + mHCPeriod = GetCyclePeriod( + X_MARKET_CYCLE_HIND, + _Period // + ); + } + else + { + mHCPeriod = hcPeriod; + } + + // + if (IsValid(mHCPeriod)) + { + mHCLength = PeriodSeconds(mHCPeriod) / cPeriodSeconds; + } + + // + result = mSCLength > 0 && + mMCLength > mSCLength && + mLCLength > mMCLength && + mHCLength > mLCLength; + + // + return result; } /** @@ -370,21 +880,35 @@ bool InitRequirements() // // Handlers ... - // // - // // SC ... - // scMaHandler = iMA( - // _Symbol, - // _Period, - // mSCMALength, - // 0, - // maMethod, - // maAppliedTo // - // ); - // result = scMaHandler != INVALID_HANDLE; - // if (!result) - // { - // return result; - // } + // + // MA ... + maHandler = iMA( + _Symbol, + _Period, + maLength, + 0, + maMethod, + maAppliedTo // + ); + result = maHandler != INVALID_HANDLE; + if (!result) + { + return result; + } + + // + // SAR ... + sarHandler = iSAR( + _Symbol, + _Period, + sarStep, + sarMax // + ); + result = sarHandler != INVALID_HANDLE; + if (!result) + { + return result; + } // mDrawer = new XCPOIDrawer(); @@ -500,6 +1024,290 @@ void CalculateValues( startCalculationForLastBars > 0 ? barIndex == startCalculationForLastBars : barIndex == firstBarIndex; + + // + // Common Requirements ... + + // + // CYCLES Ranges ... + CalculateCycleRanges( + barIndex, + prevCalculated, + ratesTotal, + open, + high, + close, + low, + tickVolume // + ); + + // + // PV ... + CalculatePV( + barIndex, + prevCalculated, + ratesTotal, + open, + high, + close, + low, + tickVolume // + ); + + // + // MA ... + double iMa = maBuffer[barIndex]; + double maState = close[barIndex] > iMa + ? bullishState + : close[barIndex] < iMa + ? bearishState + : neuturalState; + double maColor = close[barIndex] > iMa + ? bullishColorIDX + : close[barIndex] < iMa + ? bearishColorIDX + : neuturalColorIDX; + maStateBuffer[barIndex] = maState; + maColorBuffer[barIndex] = showMA + ? maColor + : hideColorIDX; + + // + // SAR ... + double iSar = sarBuffer[barIndex]; + double sarState = low[barIndex] > iSar + ? bullishState + : high[barIndex] < iSar + ? bearishState + : neuturalState; + double sarColor = low[barIndex] > iSar + ? bullishColorIDX + : high[barIndex] < iSar + ? bearishColorIDX + : neuturalColorIDX; + sarStateBuffer[barIndex] = sarState; + sarColorBuffer[barIndex] = showSAR + ? sarColor + : hideColorIDX; + + // + // FIBO Zone ... + + // + double iPeak = peakBuffer[barIndex]; + double iVale = valeBuffer[barIndex]; + + // + double iFiboUp = GetFibonacciLevel( + iPeak, + iVale, + upperZoneLevel, + X_DIRECTION_BULLISH); + + // + double iFiboLo = GetFibonacciLevel( + iPeak, + iVale, + lowerZoneLevel, + X_DIRECTION_BULLISH); + + // + fiboUpperBuffer[barIndex] = iFiboUp; + fiboLowerBuffer[barIndex] = iFiboLo; +} + +// +void CalculatePV( + int barIndex, + const int prevCalculated, + const int ratesTotal, + const double &open[], + const double &high[], + const double &close[], + const double &low[], + const long &tickVolume[] // +) +{ + // + int lastBarIndex = barIndex + 1; + bool isFirstBar = + startCalculationForLastBars > 0 + ? barIndex == startCalculationForLastBars + : barIndex == firstBarIndex; + + // + double iSHH = sHHBuffer[barIndex]; + double iSLL = sLLBuffer[barIndex]; + + // + double iMHH = mHHBuffer[barIndex]; + double iMLL = mLLBuffer[barIndex]; + + // + double iLHH = lHHBuffer[barIndex]; + double iLLL = lLLBuffer[barIndex]; + + // + double iHHH = hHHBuffer[barIndex]; + double iHLL = hLLBuffer[barIndex]; + + // + // Calculate VALE ... + bool isVale = iSLL == iMLL && + iMLL == iLLL && + iLLL == iHLL; + double iPVale = + isFirstBar + ? emptyValue + : valeBuffer[lastBarIndex]; + double iVale = + isVale + ? iSLL + : iPVale; + valeBuffer[barIndex] = iVale; + + // + // Calculate PEAK ... + bool isPeak = iSHH == iMHH && + iMHH == iLHH && + iLHH == iHHH; + double iPPeak = + isFirstBar + ? emptyValue + : peakBuffer[lastBarIndex]; + double iPeak = + isPeak + ? iSHH + : iPPeak; + peakBuffer[barIndex] = iPeak; +} + +// +void CalculateCycleRanges( + int barIndex, + const int prevCalculated, + const int ratesTotal, + const double &open[], + const double &high[], + const double &close[], + const double &low[], + const long &tickVolume[] // +) +{ + // + // SHORT ... + CalculateCycle( + barIndex, + X_MARKET_CYCLE_SHORT, + sHHBuffer, + sLLBuffer // + ); + + // + // MEDIUM ... + CalculateCycle( + barIndex, + X_MARKET_CYCLE_MEDIUM, + mHHBuffer, + mLLBuffer // + ); + + // + // LONG ... + CalculateCycle( + barIndex, + X_MARKET_CYCLE_LONG, + lHHBuffer, + lLLBuffer // + ); + + // + // HIND ... + CalculateCycle( + barIndex, + X_MARKET_CYCLE_HIND, + hHHBuffer, + hLLBuffer // + ); +} + +/** + * Calculate Specified Market Cycle Info ... + * + * @param barIndex: Integer, Bar Index ... + * @param cycle: ENUM_X_MARKET_CYCLES member, Specified Cycle ... + * @param hhBuffer: Highest High Buffer Reference ... + * @param llBuffer: Lowest Low Buffer Reference ... + */ +void CalculateCycle( + int barIndex, + ENUM_X_MARKET_CYCLES cycle, + double &hhBuffer[], + double &llBuffer[] // +) +{ + // + XOHCL bar; + bool isBarInited = bar.Init( + _Symbol, + _Period, + barIndex + // + ); + if (!isBarInited) + { + return; + } + + // + int mLength = 0; + switch (cycle) + { + // + case X_MARKET_CYCLE_SHORT: + mLength = mSCLength; + break; + + // + case X_MARKET_CYCLE_MEDIUM: + mLength = mMCLength; + break; + + // + case X_MARKET_CYCLE_LONG: + mLength = mLCLength; + break; + + // + case X_MARKET_CYCLE_HIND: + mLength = mHCLength; + break; + } + + // + if (mLength == 0) + { + return; + } + + // + // Find Highest High ... + double hhValue = bar.FindHighest( + mLength, + upperMode // + ); + hhBuffer[barIndex] = hhValue; + + // + // Find Lowest Low ... + double llValue = bar.FindLowest( + mLength, + lowerMode // + ); + llBuffer[barIndex] = llValue; + + // + bar.Clean(); } // \ No newline at end of file