/////////////////////////////////////////////////////// // // SaherElm IT Center MQL5 Indicator // ------------------------------------------------- // Name: XCXCAEAPOIDetector ... // Description: Class for XCAEA POI Detector ... // // // Maintainer: // ------------ // Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) // ////////////////////////////////////////////////////// // // Global Properties ... #property copyright "Copyright 2023, SaherElm IT Center" #property link "https://saherelm.ir" #property version "1.00" #property description "SaherElm Class for XCAEA POI Detector" #property strict // // Imports ... #include "../../Classes/x-saherelm.x-bar.analyser.class.mq5" #include "../../Classes/x-saherelm.x-poi.drawer.class.mq5" #include "../Helpers/xcaea.helper.mq5" // // Definitions ... // enum ENUM_XCA_PIVOTS { XCA_NONE, // None XCA_SWL, // SWL XCA_SWH, // SWH XCA_VALE, // VALE XCA_PEAK, // PEAK XCA_KI_BULL, // KIBull XCA_KI_BEAR, // KIBear XCA_TKI_BULL, // TKIBull XCA_TKI_BEAR, // TKIBear XCA_PEAKSWHRES, // PeakSWHRes XCA_VALESWLSUP, // ValeSWLSup XCA_TREND_BULL, // Trend Bullish XCA_TREND_BEAR, // Trend Bearish }; // bool IsValid(ENUM_XCA_PIVOTS value) { // bool result = false; // result = value != XCA_NONE; // return result; } // string ToString(ENUM_XCA_PIVOTS value) { // string result = NULL; // result = EnumToString(value); // return result; } // struct XCAPivot { // // Props ... datetime to; double value; string symbol; datetime from; double reserve; ENUM_XCA_PIVOTS type; ENUM_TIMEFRAMES period; // double values[]; // // Constructor ... XCAPivot() { Clean(); } // // Tools ... /** * Cleanup ... */ void Clean() { // value = 0; to = NULL; reserve = 0; from = NULL; symbol = NULL; period = NULL; type = XCA_NONE; // Clean(values); } /** * Validate ... * * @return ( bool ) */ bool IsValid() { // bool result = false; // result = from < to && value != 0 && IsValid(to) && IsValid(from) && IsValid(type) && IsValid(symbol) && IsValid(period); // return result; } /** * Check a Model is Same as this or not ... * * @param pivot: XCAPivot ... * * @return ( bool ) */ bool IsSameAs(XCAPivot &pivot) { // bool result = false; // result = IsValid() && pivot.IsValid(); if (!result) { return result; } // result = to == pivot.to && from == pivot.from && type == pivot.type && value == pivot.value && symbol == pivot.symbol && period == pivot.period; // return result; } /** * Retrieve To Index ... * * @param forPeriod: ENUM_TIMEFRAMES, Specified Period ... * * @return ( int ) */ int ToIndex( ENUM_TIMEFRAMES forPeriod = NULL // ) { // int result = -1; // if (!IsValid()) { return result; } // if (!IsValid(forPeriod)) { forPeriod = period; } // result = GetBarIndex( symbol, forPeriod, to // ); // return result; } /** * Retrieve From Index ... * * @param forPeriod: ENUM_TIMEFRAMES, Specified Period ... * * @return ( int ) */ int FromIndex( ENUM_TIMEFRAMES forPeriod = NULL // ) { // int result = -1; // if (!IsValid()) { return result; } // if (!IsValid(forPeriod)) { forPeriod = period; } // result = GetBarIndex( symbol, forPeriod, from // ); // return result; } /** * Retrieve Age of Pivot ... * * @param forPeriod: ENUM_TIMEFRAMES, Specified Period ... * * @return ( int ) */ int GetAge( ENUM_TIMEFRAMES forPeriod = NULL // ) { // int result = 0; // if (!IsValid()) { return result; } // if (!IsValid(forPeriod)) { forPeriod = period; } // int toIDX = ToIndex(forPeriod); int fromIDX = FromIndex(forPeriod); // result = fromIDX - toIDX; // return result; } /** * Converts Pivot to Box ... * * @param box: XBoxZone instance reference ... * * @return ( bool ) */ bool AsBox( XBoxZone &box // ) { // bool result = false; // box.Clean(); // result = IsValid(); if (!result) { return result; } // ENUM_X_DIRECTION iDir = X_DIRECTION_NONE; switch (type) { // case XCA_SWL: case XCA_VALE: case XCA_KI_BULL: case XCA_TKI_BULL: case XCA_TREND_BULL: case XCA_VALESWLSUP: iDir = X_DIRECTION_BULLISH; break; // case XCA_SWH: case XCA_PEAK: case XCA_KI_BEAR: case XCA_TKI_BEAR: case XCA_TREND_BEAR: case XCA_PEAKSWHRES: iDir = X_DIRECTION_BEARISH; break; } // result = HasDirection(iDir); if (!result) { return result; } // bool isBullish = IsBullish(iDir) && value < reserve; // bool isBearish = IsBearish(iDir) && value > reserve; // result = isBullish || isBearish; if (!result) { return result; } // box.to = to; box.dir = iDir; box.from = from; box.symbol = symbol; box.period = period; // string typeStr = ToString(type); if (type == XCA_KI_BULL || type == XCA_KI_BEAR) { // typeStr = "XCA_KI"; } else if (type == XCA_TKI_BULL || type == XCA_TKI_BEAR) { // typeStr = "XCA_TKI"; } else if (type == XCA_TREND_BULL || type == XCA_TREND_BEAR) { // typeStr = "XCA_TREND"; } box.type = typeStr; // box.upper = isBullish ? reserve : value; box.lower = isBullish ? value : reserve; // result = box.IsValid(); if (!result) { box.Clean(); } // return result; } // }; /** * Find Specified Pivot Index inside a Collection of Pivots ... * * @param pivot: XCAPivot instance Reference ... * @param pivots: XCAPivot instance Reference Collection ... * * @return ( int ) */ bool FindPivotIndex( int &index, XCAPivot &pivot, XCAPivot &pivots[] // ) { // bool result = false; // index = -1; // int count = ArraySize(pivots); result = pivot.IsValid() && IsValidSize(count); if (!result) { return result; } // for (int i = 0; i < count; i++) { // XCAPivot iPivot = pivots[i]; // bool isSame = pivot.IsSameAs(iPivot); if (isSame) { // index = i; break; } } // result = IsValidIndex(index); // return result; } // // Implementations ... class XCXCAEAPOIDetector : public XCBase { // // Public ... public: // // Props ... XCAPivot swhPivots[]; XCAPivot swlPivots[]; XCAPivot peakPivots[]; XCAPivot valePivots[]; XCAPivot kiBullishPivots[]; XCAPivot kiBearishPivots[]; XCAPivot tkiBullishPivots[]; XCAPivot tkiBearishPivots[]; XCAPivot peakSWHResPivots[]; XCAPivot valeSWLSupPivots[]; XCAPivot trendBullishPivots[]; XCAPivot trendBearishPivots[]; // // Constructors ... XCXCAEAPOIDetector( XCXCAEAHelper *_helper // ) { // helper = _helper; drawer = new XCPOIDrawer(); barAnalyser = new XCBarAnalyser(); // Default(); } // // De Constructors ... ~XCXCAEAPOIDetector() { // peakPivot.Clean(); Clean(peakPivots); // valePivot.Clean(); Clean(valePivots); // peakSWHResPivot.Clean(); Clean(peakSWHResPivots); // valeSWLSupPivot.Clean(); Clean(valeSWLSupPivots); // ZeroMemory(helper); ZeroMemory(drawer); ZeroMemory(barAnalyser); } // // Properties ... // // Tools ... virtual void Default() { // maxAllowedPivots = 50; pivotVerifications = 5; } // void Update( int barIndex = 0, int loopback = 400 // ) { // if (barIndex < 0) { barIndex = 0; } // loopback = NormalizeInt(loopback, 400); // int count = 0; bool has = false; // int zIDX = 0; int cIDX = zIDX + 1; int pIDX = cIDX + 1; int p2IDX = pIDX + 1; // int index = barIndex; int start = index; int end = index + loopback; while (start < end) { // // Retrieve Conditions ... XCAEAConditions iConditions; has = helper.GetConditions( iConditions, start, 5 // ); // // Retrieve Bars ... XOHCL zBar; XOHCL cBar; XOHCL pBar; XOHCL p2Bar; has = zBar.Init( iConditions.symbol, iConditions.period, start // ); has = has && zBar.GetPreviousBar(cBar); has = has && cBar.GetPreviousBar(pBar); has = has && pBar.GetPreviousBar(p2Bar); if (!has) { // zBar.Clean(); cBar.Clean(); pBar.Clean(); p2Bar.Clean(); iConditions.Clean(); // continue; } // // Checking Pivots ... // bool detectSWHPivot = false; bool detectSWLPivot = false; bool detectPeakPivot = false; bool detectValePivot = false; bool detectKIBullishPivot = false; bool detectKIBearishPivot = false; bool detectTKIBullishPivot = false; bool detectTKIBearishPivot = false; bool detectPeakSWHResPivot = false; bool detectValeSWLSupPivot = false; bool detectTrendBullishPivot = true; bool detectTrendBearishPivot = true; // // Peak Pivot ... if (detectPeakPivot) { // if (!peakPivot.IsValid()) { // peakPivot.type = XCA_PEAK; peakPivot.symbol = iConditions.symbol; peakPivot.period = iConditions.period; // if (iConditions.isPeakSameLast) { // peakPivot.to = cBar.time; peakPivot.from = pBar.time; peakPivot.value = iConditions.peakBuffer[cIDX]; } } // if (iConditions.isPeakSameLast) { // peakPivot.from = pBar.time; peakPivot.reserve = peakPivot.reserve == 0 ? iConditions.peakGoldenBuffer[cIDX] : MathMax(peakPivot.reserve, iConditions.peakGoldenBuffer[cIDX]); } // if (!iConditions.isPeakSameLast) { // has = peakPivot.IsValid() && peakPivot.GetAge() >= pivotVerifications; if (has) { // AddPivot( peakPivot, peakPivots // ); } // peakPivot.Clean(); } } // // Peak SWH Res Pivot ... if (detectPeakSWHResPivot) { // if (!peakSWHResPivot.IsValid()) { // peakSWHResPivot.type = XCA_PEAKSWHRES; peakSWHResPivot.symbol = iConditions.symbol; peakSWHResPivot.period = iConditions.period; // if (iConditions.isPeakIsPivot && iConditions.isPeakSameLast) { // peakSWHResPivot.to = cBar.time; peakSWHResPivot.from = pBar.time; peakSWHResPivot.value = iConditions.peakBuffer[cIDX]; } } // if (iConditions.isPeakIsPivot && iConditions.isPeakSameLast) { // peakSWHResPivot.from = pBar.time; peakSWHResPivot.reserve = peakSWHResPivot.reserve == 0 ? iConditions.peakGoldenBuffer[cIDX] : MathMax(peakSWHResPivot.reserve, iConditions.peakGoldenBuffer[cIDX]); } // if (!(iConditions.isPeakIsPivot && iConditions.isPeakSameLast)) { // has = peakSWHResPivot.IsValid() && peakSWHResPivot.GetAge() >= pivotVerifications; if (has) { // AddPivot( peakSWHResPivot, peakSWHResPivots // ); } // peakSWHResPivot.Clean(); } } // // Vale Pivot ... if (detectValePivot) { // if (!valePivot.IsValid()) { // valePivot.type = XCA_VALE; valePivot.symbol = iConditions.symbol; valePivot.period = iConditions.period; // if (iConditions.isValeSameLast) { // valePivot.to = cBar.time; valePivot.from = pBar.time; valePivot.value = iConditions.valeBuffer[cIDX]; } } // if (iConditions.isValeSameLast) { // valePivot.from = pBar.time; valePivot.reserve = valePivot.reserve == 0 ? iConditions.valeGoldenBuffer[cIDX] : MathMin(valePivot.reserve, iConditions.valeGoldenBuffer[cIDX]); } // if (!iConditions.isValeSameLast) { // has = valePivot.IsValid() && valePivot.GetAge() >= pivotVerifications; if (has) { // AddPivot( valePivot, valePivots // ); } // valePivot.Clean(); } } // // Vale SWL Sup Pivot ... if (detectValeSWLSupPivot) { // if (!valeSWLSupPivot.IsValid()) { // valeSWLSupPivot.type = XCA_VALESWLSUP; valeSWLSupPivot.symbol = iConditions.symbol; valeSWLSupPivot.period = iConditions.period; // if (iConditions.isValeIsPivot && iConditions.isValeSameLast) { // valeSWLSupPivot.to = cBar.time; valeSWLSupPivot.from = pBar.time; valeSWLSupPivot.value = iConditions.valeBuffer[cIDX]; } } // if (iConditions.isValeIsPivot && iConditions.isValeSameLast) { // valeSWLSupPivot.from = pBar.time; valeSWLSupPivot.reserve = valeSWLSupPivot.reserve == 0 ? iConditions.valeGoldenBuffer[cIDX] : MathMin(valeSWLSupPivot.reserve, iConditions.valeGoldenBuffer[cIDX]); } // if (!(iConditions.isValeIsPivot && iConditions.isValeSameLast)) { // has = valeSWLSupPivot.IsValid() && valeSWLSupPivot.GetAge() >= pivotVerifications; if (has) { // AddPivot( valeSWLSupPivot, valeSWLSupPivots // ); } // valeSWLSupPivot.Clean(); } } // // SWH Pivot ... if (detectSWHPivot) { // if (!swhPivot.IsValid()) { // swhPivot.type = XCA_SWH; swhPivot.symbol = iConditions.symbol; swhPivot.period = iConditions.period; // if (iConditions.isSwingHighSameLast) { // swhPivot.to = cBar.time; swhPivot.from = pBar.time; swhPivot.value = iConditions.swingHighBuffer[cIDX]; } } // if (iConditions.isSwingHighSameLast) { swhPivot.from = pBar.time; } // if (!iConditions.isSwingHighSameLast) { // has = swhPivot.IsValid() && cBar.high > cBar.GetUp() && cBar.high == swhPivot.value && swhPivot.GetAge() >= pivotVerifications; if (has) { // swhPivot.reserve = cBar.GetUp(); // AddPivot( swhPivot, swhPivots // ); } // swhPivot.Clean(); } } // // SWL Pivot ... if (detectSWLPivot) { // if (!swlPivot.IsValid()) { // swlPivot.type = XCA_SWL; swlPivot.symbol = iConditions.symbol; swlPivot.period = iConditions.period; // if (iConditions.isSwingLowSameLast) { // swlPivot.to = cBar.time; swlPivot.from = pBar.time; swlPivot.value = iConditions.swingLowBuffer[cIDX]; } } // if (iConditions.isSwingLowSameLast) { swlPivot.from = pBar.time; } // if (!iConditions.isSwingLowSameLast) { // has = swlPivot.IsValid() && cBar.low < cBar.GetDown() && cBar.low == swlPivot.value && swlPivot.GetAge() >= pivotVerifications; if (has) { // swlPivot.reserve = cBar.GetDown(); // AddPivot( swlPivot, swlPivots // ); } // swlPivot.Clean(); } } // // KI Bullish ... if (detectKIBullishPivot) { // if (!kiBullishPivot.IsValid()) { // kiBullishPivot.type = XCA_KI_BULL; kiBullishPivot.symbol = iConditions.symbol; kiBullishPivot.period = iConditions.period; // if (iConditions.isKIBullish) { // kiBullishPivot.to = cBar.time; kiBullishPivot.from = pBar.time; kiBullishPivot.value = iConditions.kiBuffer[cIDX]; } } // if (iConditions.isKIBullish) { // kiBullishPivot.from = pBar.time; kiBullishPivot.value = kiBullishPivot.value == 0 ? iConditions.kiBuffer[cIDX] : MathMin(iConditions.kiBuffer[cIDX], kiBullishPivot.value); kiBullishPivot.reserve = kiBullishPivot.reserve == 0 ? iConditions.kiBuffer[cIDX] : MathMax(iConditions.kiBuffer[cIDX], kiBullishPivot.reserve); } // if (iConditions.isKISwitchedToBullish) { // has = kiBullishPivot.IsValid() && kiBullishPivot.GetAge() >= pivotVerifications; if (has) { // AddPivot( kiBullishPivot, kiBullishPivots // ); } // kiBullishPivot.Clean(); } } // // KI Bearish ... if (detectKIBearishPivot) { // if (!kiBearishPivot.IsValid()) { // kiBearishPivot.type = XCA_KI_BEAR; kiBearishPivot.symbol = iConditions.symbol; kiBearishPivot.period = iConditions.period; // if (iConditions.isKIBearish) { // kiBearishPivot.to = cBar.time; kiBearishPivot.from = pBar.time; kiBearishPivot.value = iConditions.kiBuffer[cIDX]; } } // if (iConditions.isKIBearish) { // kiBearishPivot.from = pBar.time; kiBearishPivot.value = kiBearishPivot.value == 0 ? iConditions.kiBuffer[cIDX] : MathMax(iConditions.kiBuffer[cIDX], kiBearishPivot.value); kiBearishPivot.reserve = kiBearishPivot.reserve == 0 ? iConditions.kiBuffer[cIDX] : MathMin(iConditions.kiBuffer[cIDX], kiBearishPivot.reserve); } // if (iConditions.isKISwitchedToBearish) { // has = kiBearishPivot.IsValid() && kiBearishPivot.GetAge() >= pivotVerifications; if (has) { // AddPivot( kiBearishPivot, kiBearishPivots // ); } // kiBearishPivot.Clean(); } } // // TKI Bullish ... if (detectTKIBullishPivot) { // if (!tkiBullishPivot.IsValid()) { // tkiBullishPivot.type = XCA_TKI_BULL; tkiBullishPivot.symbol = iConditions.symbol; tkiBullishPivot.period = iConditions.period; // if (iConditions.isTKIBullish) { // tkiBullishPivot.to = cBar.time; tkiBullishPivot.from = pBar.time; tkiBullishPivot.value = iConditions.tkiBuffer[cIDX]; } } // if (iConditions.isTKIBullish) { // tkiBullishPivot.from = pBar.time; tkiBullishPivot.value = tkiBullishPivot.value == 0 ? iConditions.tkiBuffer[cIDX] : MathMin(iConditions.tkiBuffer[cIDX], tkiBullishPivot.value); tkiBullishPivot.reserve = tkiBullishPivot.reserve == 0 ? iConditions.tkiBuffer[cIDX] : MathMax(iConditions.tkiBuffer[cIDX], tkiBullishPivot.reserve); } // if (iConditions.isTKISwitchedToBullish) { // has = tkiBullishPivot.IsValid() && tkiBullishPivot.GetAge() >= pivotVerifications; if (has) { // AddPivot( tkiBullishPivot, tkiBullishPivots // ); } // tkiBullishPivot.Clean(); } } // // TKI Bearish ... if (detectTKIBearishPivot) { // if (!tkiBearishPivot.IsValid()) { // tkiBearishPivot.type = XCA_TKI_BEAR; tkiBearishPivot.symbol = iConditions.symbol; tkiBearishPivot.period = iConditions.period; // if (iConditions.isTKIBearish) { // tkiBearishPivot.to = cBar.time; tkiBearishPivot.from = pBar.time; tkiBearishPivot.value = iConditions.tkiBuffer[cIDX]; } } // if (iConditions.isTKIBearish) { // tkiBearishPivot.from = pBar.time; tkiBearishPivot.value = tkiBearishPivot.value == 0 ? iConditions.kiBuffer[cIDX] : MathMax(iConditions.kiBuffer[cIDX], tkiBearishPivot.value); tkiBearishPivot.reserve = tkiBearishPivot.reserve == 0 ? iConditions.kiBuffer[cIDX] : MathMin(iConditions.kiBuffer[cIDX], tkiBearishPivot.reserve); } // if (iConditions.isTKISwitchedToBearish) { // has = tkiBearishPivot.IsValid() && tkiBearishPivot.GetAge() >= pivotVerifications; if (has) { // AddPivot( tkiBearishPivot, tkiBearishPivots // ); } // tkiBearishPivot.Clean(); } } // // TREND Bullish ... if (detectTrendBullishPivot) { // if (!trendBullishPivot.IsValid()) { // trendBullishPivot.type = XCA_TREND_BULL; trendBullishPivot.symbol = iConditions.symbol; trendBullishPivot.period = iConditions.period; // if (iConditions.isTrendBullish) { // trendBullishPivot.to = cBar.time; trendBullishPivot.from = pBar.time; trendBullishPivot.value = iConditions.trendBuffer[cIDX]; trendBullishPivot.reserve = iConditions.trendBuffer[cIDX]; } } // if (iConditions.isTrendBullish) { // Add( iConditions.trendBuffer[cIDX], trendBullishPivot.values // ); // trendBullishPivot.from = pBar.time; // trendBullishPivot.value = trendBullishPivot.value == 0 ? iConditions.trendBuffer[cIDX] : MathMin(iConditions.trendBuffer[cIDX], trendBullishPivot.value); trendBullishPivot.reserve = trendBullishPivot.reserve == 0 ? iConditions.trendBuffer[cIDX] : MathMax(iConditions.trendBuffer[cIDX], trendBullishPivot.reserve); } // if (iConditions.isTrendSwitchedToBullish) { // has = trendBullishPivot.IsValid() && trendBullishPivot.GetAge() >= pivotVerifications; if (has) { // // // double ivMin = GetMin(trendBullishPivot.values); // double ivMax = GetMax(trendBullishPivot.values); // // // trendBullishPivot.value = ivMin; // trendBullishPivot.reserve = ivMax; // AddPivot( trendBullishPivot, trendBullishPivots // ); } // trendBullishPivot.Clean(); } } // // TREND Bearish ... if (detectTrendBearishPivot) { // if (!trendBearishPivot.IsValid()) { // trendBearishPivot.type = XCA_TREND_BEAR; trendBearishPivot.symbol = iConditions.symbol; trendBearishPivot.period = iConditions.period; // if (iConditions.isTrendBearish) { // trendBearishPivot.to = cBar.time; trendBearishPivot.from = pBar.time; trendBearishPivot.value = iConditions.trendBuffer[cIDX]; trendBearishPivot.reserve = iConditions.trendBuffer[cIDX]; } } // if (iConditions.isTrendBearish) { // Add( iConditions.trendBuffer[cIDX], trendBearishPivot.values // ); // trendBearishPivot.from = pBar.time; // trendBearishPivot.value = trendBearishPivot.value == 0 ? iConditions.trendBuffer[cIDX] : MathMax(iConditions.trendBuffer[cIDX], trendBearishPivot.value); trendBearishPivot.reserve = trendBearishPivot.reserve == 0 ? iConditions.trendBuffer[cIDX] : MathMin(iConditions.trendBuffer[cIDX], trendBearishPivot.reserve); } // if (iConditions.isTrendSwitchedToBearish) { // has = trendBearishPivot.IsValid() && trendBearishPivot.GetAge() >= pivotVerifications; if (has) { // // // double ivMin = GetMin(trendBearishPivot.values); // double ivMax = GetMax(trendBearishPivot.values); // // // trendBearishPivot.value = ivMax; // trendBearishPivot.reserve = ivMin; // AddPivot( trendBearishPivot, trendBearishPivots // ); } // trendBearishPivot.Clean(); } } // start++; // zBar.Clean(); cBar.Clean(); pBar.Clean(); p2Bar.Clean(); iConditions.Clean(); } // } // // POI Handlers ... // // Peaks ... // bool HasPeakPivots() { return HasChild(peakPivots); } // int CountPeakPivots() { return ArraySize(peakPivots); } // // Peak SWH Res ... // bool HasPeakSWHResPivots() { return HasChild(peakSWHResPivots); } // int CountPeakSWHResPivots() { return ArraySize(peakSWHResPivots); } // // Vale ... // bool HasValePivots() { return HasChild(valePivots); } // int CountValePivots() { return ArraySize(valePivots); } // // ValeSWLSup ... // bool HasValeSWLSupPivots() { return HasChild(valeSWLSupPivots); } // int CountValeSWLSupPivots() { return ArraySize(valeSWLSupPivots); } // // Swing High ... // bool HasSWHPivots() { return HasChild(swhPivots); } // int CountSWHPivots() { return ArraySize(swhPivots); } // // Swing Low ... // bool HasSWLPivots() { return HasChild(swlPivots); } // int CountSWLPivots() { return ArraySize(swlPivots); } // // KI ... // bool HasKIBullishPivots() { return HasChild(kiBullishPivots); } // int CountKIBullishPivots() { return ArraySize(kiBullishPivots); } // bool HasKIBearishPivots() { return HasChild(kiBearishPivots); } // int CountKIBearishPivots() { return ArraySize(kiBearishPivots); } // // TKI ... // bool HasTKIBullishPivots() { return HasChild(tkiBullishPivots); } // int CountTKIBullishPivots() { return ArraySize(tkiBullishPivots); } // bool HasTKIBearishPivots() { return HasChild(tkiBearishPivots); } // int CountTKIBearishPivots() { return ArraySize(tkiBearishPivots); } // // TREND ... // bool HasTrendBullishPivots() { return HasChild(trendBullishPivots); } // int CountTrendBullishPivots() { return ArraySize(trendBullishPivots); } // bool HasTrendBearishPivots() { return HasChild(trendBearishPivots); } // int CountTrendBearishPivots() { return ArraySize(trendBearishPivots); } // // Protected ... protected: // // Props ... // // Prrivate ... private: // // Props ... int pivotVerifications; // Pivots Verifications ... int maxAllowedPivots; // Max Allowed Holding Pibots ... // XCAPivot swhPivot; XCAPivot swlPivot; XCAPivot peakPivot; XCAPivot valePivot; XCAPivot kiBullishPivot; XCAPivot kiBearishPivot; XCAPivot tkiBullishPivot; XCAPivot tkiBearishPivot; XCAPivot peakSWHResPivot; XCAPivot valeSWLSupPivot; XCAPivot trendBullishPivot; XCAPivot trendBearishPivot; // XCPOIDrawer *drawer; XCXCAEAHelper *helper; XCBarAnalyser *barAnalyser; // void AddBox( XBoxZone &box, XBoxZone &boxes[] // ) { // bool has = box.IsValid(); if (!has) { return; } // int idx = -1; has = FindBoxIndex( idx, box, boxes // ); if (has) { return; } // AddRef( box, boxes // ); } // void AddPivot( XCAPivot &pivot, XCAPivot &pivots[] // ) { // bool has = pivot.IsValid(); if (!has) { return; } // int idx = -1; has = FindPivotIndex( idx, pivot, pivots // ); if (has) { return; } // int updateIDX = -1; int count = ArraySize(pivots); for (int i = 0; i < count; i++) { // XCAPivot iPivot = pivots[i]; // has = iPivot.to < pivot.to && iPivot.from == pivot.from && iPivot.value == pivot.value && iPivot.symbol == pivot.symbol && iPivot.period == pivot.period; if (has) { // updateIDX = i; break; } } // has = IsValidIndex(updateIDX); if (!has) { // AddRef( pivot, pivots // ); } else { // pivots[updateIDX].to = pivot.to; } // // Apply Max Allowed ... CleanupArray( pivots, maxAllowedPivots // ); } // }; //