From 86846de1d101fa5d5442d06e128c6dddce1dcaed Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Sun, 27 Apr 2025 02:16:59 +0330 Subject: [PATCH] last ... --- XCAEA/Classes/xcaea.x-poi.detector.class.mq5 | 392 +++- XCAEA/Classes/xcaea.x-poi.drawer.class.mq5 | 1888 ++++++++++++------ XCAEA/Libraries/xcaea.signaller.lib.mq5 | 126 ++ XCAEA/Signals/xcaea.signaller.class.mq5 | 3 +- 4 files changed, 1795 insertions(+), 614 deletions(-) diff --git a/XCAEA/Classes/xcaea.x-poi.detector.class.mq5 b/XCAEA/Classes/xcaea.x-poi.detector.class.mq5 index 9ffb58d0..6373be5c 100644 --- a/XCAEA/Classes/xcaea.x-poi.detector.class.mq5 +++ b/XCAEA/Classes/xcaea.x-poi.detector.class.mq5 @@ -33,6 +33,8 @@ enum ENUM_XCA_PIVOTS { XCA_NONE, // None + XCA_TICK, // Tick + XCA_VOLUME, // Volume XCA_FVG_BULL, // FVGBull XCA_FVG_BEAR, // FVGBear XCA_RSI_COOS, // RSICOOS @@ -121,6 +123,8 @@ string GetBoxType(ENUM_XCA_PIVOTS value) switch (value) { // + case XCA_TICK: + case XCA_VOLUME: case XCA_RSI_COOS: case XCA_RSI_VALE: case XCA_CCI_COOS: @@ -150,6 +154,163 @@ string GetBoxType(ENUM_XCA_PIVOTS value) return result; } +// +ENUM_XCA_PIVOTS GetPivotType(XBoxZone &value) +{ + // + ENUM_XCA_PIVOTS result = XCA_NONE; + + // + bool has = value.IsValid(); + if (!has) + { + return result; + } + + // + bool isTick = value.type == GetBoxType(XCA_TICK); + bool isVolume = value.type == GetBoxType(XCA_VOLUME); + bool isFVGBull = value.type == GetBoxType(XCA_FVG_BULL) && + value.dir == GetDirection(XCA_FVG_BULL); + bool isFVGBear = value.type == GetBoxType(XCA_FVG_BEAR) && + value.dir == GetDirection(XCA_FVG_BEAR); + bool isRSIPeak = value.type == GetBoxType(XCA_RSI_PEAK) && + value.dir == GetDirection(XCA_RSI_PEAK); + bool isRSIVale = value.type == GetBoxType(XCA_RSI_VALE) && + value.dir == GetDirection(XCA_RSI_VALE); + bool isCCIPeak = value.type == GetBoxType(XCA_CCI_PEAK) && + value.dir == GetDirection(XCA_CCI_PEAK); + bool isCCIVale = value.type == GetBoxType(XCA_CCI_VALE) && + value.dir == GetDirection(XCA_CCI_VALE); + bool isRSICrossedOverOS = value.type == GetBoxType(XCA_RSI_COOS) && + value.dir == GetDirection(XCA_RSI_COOS); + bool isRSICrossedUnderOB = value.type == GetBoxType(XCA_RSI_CUOB) && + value.dir == GetDirection(XCA_RSI_CUOB); + bool isCCICrossedOverOS = value.type == GetBoxType(XCA_CCI_COOS) && + value.dir == GetDirection(XCA_CCI_COOS); + bool isCCICrossedUnderOB = value.type == GetBoxType(XCA_CCI_CUOB) && + value.dir == GetDirection(XCA_CCI_CUOB); + bool isTrendBullish = value.type == GetBoxType(XCA_TREND_BULL) && + value.dir == GetDirection(XCA_TREND_BULL); + bool isTrendBearish = value.type == GetBoxType(XCA_TREND_BEAR) && + value.dir == GetDirection(XCA_TREND_BEAR); + + // + if (isTick) + { + result = XCA_TICK; + } + else if (isVolume) + { + result = XCA_VOLUME; + } + else if (isFVGBull) + { + result = XCA_FVG_BULL; + } + else if (isFVGBear) + { + result = XCA_FVG_BEAR; + } + else if (isRSIPeak) + { + result = XCA_RSI_PEAK; + } + else if (isRSIVale) + { + result = XCA_RSI_VALE; + } + else if (isCCIPeak) + { + result = XCA_CCI_PEAK; + } + else if (isCCIVale) + { + result = XCA_CCI_VALE; + } + else if (isRSICrossedOverOS) + { + result = XCA_RSI_COOS; + } + else if (isRSICrossedUnderOB) + { + result = XCA_RSI_CUOB; + } + else if (isCCICrossedOverOS) + { + result = XCA_CCI_COOS; + } + else if (isCCICrossedUnderOB) + { + result = XCA_CCI_CUOB; + } + else if (isTrendBullish) + { + result = XCA_TREND_BULL; + } + else if (isTrendBearish) + { + result = XCA_TREND_BEAR; + } + + // + return result; +} + +// +int ExtractPivots( + XBoxZone &extracted[], + ENUM_XCA_PIVOTS type, + XBoxZone &source[] // +) +{ + // + int result = 0; + + // + Clean(extracted); + + // + bool has = + IsValid(type) && + HasChild(source); + if (!has) + { + return result; + } + + // + int count = ArraySize(source); + for (int i = 0; i < count; i++) + { + // + XBoxZone iBox = source[i]; + + // + ENUM_XCA_PIVOTS iType = GetPivotType(iBox); + + // + has = iType == type; + if (has) + { + // + AddRef( + iBox, + extracted // + ); + } + + // + iBox.Clean(); + } + + // + result = ArraySize(extracted); + + // + return result; +} + // struct XCAPivot { @@ -580,6 +741,217 @@ struct XCATRENDFVG // }; +// +int ExtractTrendFVGs( + XBoxZone &extracteds[], + XBoxZone &trend, + XBoxZone &fvgs[] // +) +{ + // + int result = 0; + + // + Clean(extracteds); + + // + bool has = HasChild(fvgs) && + trend.IsValid(); + if (!has) + { + return result; + } + + // + // Check Trend Box Pivot is Valid Trend ... + ENUM_XCA_PIVOTS iType = GetPivotType(trend); + has = iType == XCA_TREND_BULL || + iType == XCA_TREND_BEAR; + if (!has) + { + return result; + } + + // + int count = ArraySize(fvgs); + for (int i = 0; i < count; i++) + { + // + XBoxZone iFVG = fvgs[i]; + + // + bool isDirPassed = iFVG.dir == trend.dir; + bool isPricePassed = iFVG.upper <= trend.upper && + iFVG.lower >= trend.lower; + bool isFromPassed = iFVG.from > trend.from; + has = + isDirPassed && + isFromPassed && + isPricePassed; + if (has) + { + // + AddRef( + iFVG, + extracteds // + ); + } + + // + iFVG.Clean(); + } + + // + result = ArraySize(extracteds); + + // + return result; +} + +// +int ExtractTrendPivots( + XCATRENDFVG &items[], + XBoxZone &boxes[] // +) +{ + // + int result = 0; + + // + Clean(items); + + // + bool has = HasChild(boxes); + if (!has) + { + return result; + } + + // + // Extract Trend Boxes ... + XBoxZone tmp[]; + XBoxZone trendBoxes[]; + ExtractPivots( + tmp, + XCA_TREND_BULL, + boxes // + ); + Copy( + tmp, + trendBoxes, + false // + ); + Clean(tmp); + ExtractPivots( + tmp, + XCA_TREND_BEAR, + boxes // + ); + Copy( + tmp, + trendBoxes, + false // + ); + Clean(tmp); + + // + // Check Trend Boxes Exists ... + has = HasChild(trendBoxes); + if (!has) + { + // + Clean(trendBoxes); + return result; + } + + // + // Extract FVG Boxes ... + XBoxZone fvgBoxes[]; + + // + ExtractPivots( + tmp, + XCA_FVG_BULL, + boxes // + ); + Copy( + tmp, + fvgBoxes, + false // + ); + Clean(tmp); + ExtractPivots( + tmp, + XCA_FVG_BEAR, + boxes // + ); + Copy( + tmp, + fvgBoxes, + false // + ); + Clean(tmp); + bool hasFVGs = HasChild(fvgBoxes); + int fvgsCount = ArraySize(fvgBoxes); + + // + // Loop through Trend Boxes to Extract XCATRENDFVG Models ... + int count = ArraySize(trendBoxes); + for (int i = 0; i < count; i++) + { + // + XBoxZone iTrendBox = trendBoxes[i]; + + // + XCATRENDFVG iTrendFVG; + iTrendFVG.trend = iTrendBox; + + // + XBoxZone fvgs[]; + if (hasFVGs) + { + // + int fvgsCount = ExtractTrendFVGs( + fvgs, + iTrendBox, + fvgBoxes // + ); + + // + Copy( + fvgs, + iTrendFVG.fvgs // + ); + } + + // + has = iTrendFVG.IsValid(); + if (has) + { + // + AddRef( + iTrendFVG, + items // + ); + } + + // + iTrendBox.Clean(); + iTrendFVG.Clean(); + } + + // + Clean(tmp); + Clean(fvgBoxes); + Clean(trendBoxes); + + // + result = ArraySize(items); + + // + return result; +} + // int GetOldest(XCATRENDFVG &items[]) { @@ -1382,7 +1754,7 @@ class XCXCAEAPOIDetector : public XCBase iBox.upper = iZone.high; iBox.symbol = iZone.symbol; iBox.period = iZone.period; - iBox.type = "XCA_MAX_TICK"; + iBox.type = GetBoxType(XCA_TICK); iBox.dir = X_DIRECTION_BULLISH; // Temparory ... // @@ -1425,7 +1797,7 @@ class XCXCAEAPOIDetector : public XCBase iBox.upper = iZone.high; iBox.symbol = iZone.symbol; iBox.period = iZone.period; - iBox.type = "XCA_MAX_VOLUME"; + iBox.type = GetBoxType(XCA_VOLUME); iBox.dir = X_DIRECTION_BULLISH; // Temparory ... // @@ -2040,7 +2412,7 @@ class XCXCAEAPOIDetector : public XCBase // Update Values ... trendBullishPivot.value = GetMin(trendBullishPivot.values); trendBullishPivot.reserve = GetMax(trendBullishPivot.values); - + // has = trendBullishPivot.IsValid() && @@ -2151,7 +2523,7 @@ class XCXCAEAPOIDetector : public XCBase // Update Values ... trendBearishPivot.value = GetMax(trendBearishPivot.values); trendBearishPivot.reserve = GetMin(trendBearishPivot.values); - + // has = trendBearishPivot.IsValid() && @@ -2877,6 +3249,12 @@ class XCXCAEAPOIDetector : public XCBase count = CountTrendBullishPivots(); for (int i = 0; i < count; i++) { + // + AddRef( + trendBullishPivots[i].trend, + pivots // + ); + // XBoxZone iBox; has = trendBullishPivots[i].GetSelectedFVG(iBox); @@ -2949,6 +3327,12 @@ class XCXCAEAPOIDetector : public XCBase count = CountTrendBearishPivots(); for (int i = 0; i < count; i++) { + // + AddRef( + trendBearishPivots[i].trend, + pivots // + ); + // XBoxZone iBox; has = trendBearishPivots[i].GetSelectedFVG(iBox); diff --git a/XCAEA/Classes/xcaea.x-poi.drawer.class.mq5 b/XCAEA/Classes/xcaea.x-poi.drawer.class.mq5 index c3205985..f751ba8b 100644 --- a/XCAEA/Classes/xcaea.x-poi.drawer.class.mq5 +++ b/XCAEA/Classes/xcaea.x-poi.drawer.class.mq5 @@ -318,6 +318,219 @@ class XCXCAEAPOIDrawer : public XCBase DrawCCICrossedUnderOBPivots(to); } + // + void DrawBoxes( + XBoxZone &boxes[], + datetime to = NULL // + ) + { + // + bool has = HasChild(boxes); + if (!has) + { + return; + } + + // + int count = ArraySize(boxes); + for (int i = 0; i < count; i++) + { + // + XBoxZone iBox = boxes[i]; + + // + // Detect Pivot Type ... + ENUM_XCA_PIVOTS iType = GetPivotType(iBox); + has = IsValid(iType); + if (!has) + { + // + iBox.Clean(); + + // + continue; + } + + // + switch (iType) + { + // + case XCA_TICK: + // + DrawTickPivot( + iBox, + to // + ); + break; + + // + case XCA_VOLUME: + // + DrawVolumePivot( + iBox, + to // + ); + break; + + // + case XCA_FVG_BULL: + // + DrawFVGBullishPivot( + iBox, + to // + ); + break; + + // + case XCA_FVG_BEAR: + // + DrawFVGBearishPivot( + iBox, + to // + ); + break; + + // + case XCA_RSI_COOS: + // + DrawRSICrossedOverOSPivot( + iBox, + to // + ); + break; + + // + case XCA_RSI_CUOB: + // + DrawRSICrossedUnderOBPivot( + iBox, + to // + ); + break; + + // + case XCA_RSI_PEAK: + // + DrawRSIPeakPivot( + iBox, + to // + ); + break; + + // + case XCA_RSI_VALE: + // + DrawRSIValePivot( + iBox, + to // + ); + break; + + // + case XCA_CCI_COOS: + // + DrawCCICrossedOverOSPivot( + iBox, + to // + ); + break; + + // + case XCA_CCI_CUOB: + // + DrawCCICrossedUnderOBPivot( + iBox, + to // + ); + break; + + // + case XCA_CCI_PEAK: + // + DrawCCIPeakPivot( + iBox, + to // + ); + break; + + // + case XCA_CCI_VALE: + // + DrawCCIValePivot( + iBox, + to // + ); + break; + + // + case XCA_PEAKSWHRES: + // + DrawPeakResSWHPivot( + iBox, + to // + ); + break; + + // + case XCA_VALESWLSUP: + // + DrawValeSupSWLPivot( + iBox, + to // + ); + break; + } + + // + iBox.Clean(); + }; + + // + // Trend Items ... + XCATRENDFVG trendFVGs[]; + count = ExtractTrendPivots( + trendFVGs, + boxes // + ); + has = IsValidSize(count); + if (!has) + { + return; + } + + // + for (int i = 0; i < count; i++) + { + // + XCATRENDFVG iTrendFVG = trendFVGs[i]; + + // + bool isBullish = iTrendFVG.IsBullish(); + if (isBullish) + { + // + DrawTrendBullishPivot( + iTrendFVG, + to // + ); + } + else + { + // + DrawTrendBearishPivot( + iTrendFVG, + to // + ); + } + + // + iTrendFVG.Clean(); + } + + // + Clean(trendFVGs); + } + // void Clear() { @@ -342,8 +555,7 @@ class XCXCAEAPOIDrawer : public XCBase } // - // - // + // Collection Drawers ... // void DrawTrendLine() @@ -457,9 +669,6 @@ class XCXCAEAPOIDrawer : public XCBase return; } - // - bool canUpdateTo = IsValid(to); - // int count = detector.CountTickPivots(); for (int i = 0; i < count; i++) @@ -468,33 +677,13 @@ class XCXCAEAPOIDrawer : public XCBase XBoxZone iBox = detector.tickPivots[i]; // - if (canUpdateTo) - { - iBox.to = to; - } - - // - XCBoxObject *iObj; - has = drawer.DrawBox( + DrawTickPivot( iBox, - iObj // + to // ); - if (has) - { - // - // Style Pivot ... - iObj.BoxColor(tickPivotsColor); - iObj.BoxWidth(tickPivotsWidth); - iObj.BoxStyle(tickPivotsStyle); - - // - // Store Pivot ... - mTickPivotObjects.Add(iObj); - } // iBox.Clean(); - ZeroMemory(iObj); } } @@ -515,9 +704,6 @@ class XCXCAEAPOIDrawer : public XCBase return; } - // - bool canUpdateTo = IsValid(to); - // int count = detector.CountVolumePivots(); for (int i = 0; i < count; i++) @@ -526,33 +712,13 @@ class XCXCAEAPOIDrawer : public XCBase XBoxZone iBox = detector.volumePivots[i]; // - if (canUpdateTo) - { - iBox.to = to; - } - - // - XCBoxObject *iObj; - has = drawer.DrawBox( + DrawVolumePivot( iBox, - iObj // + to // ); - if (has) - { - // - // Style Pivot ... - iObj.BoxColor(volumePivotsColor); - iObj.BoxWidth(volumePivotsWidth); - iObj.BoxStyle(volumePivotsStyle); - - // - // Store Pivot ... - mVolumePivotObjects.Add(iObj); - } // iBox.Clean(); - ZeroMemory(iObj); } } @@ -573,13 +739,6 @@ class XCXCAEAPOIDrawer : public XCBase return; } - // - if (ignoreUpdateOSCTos) - { - to = NULL; - } - bool canUpdateTo = IsValid(to); - // int count = detector.CountRSIPeakPivots(); for (int i = 0; i < count; i++) @@ -588,33 +747,13 @@ class XCXCAEAPOIDrawer : public XCBase XBoxZone iBox = detector.rsiPeakPivots[i]; // - if (canUpdateTo) - { - iBox.to = to; - } - - // - XCBoxObject *iObj; - has = drawer.DrawBox( + DrawRSIPeakPivot( iBox, - iObj // + to // ); - if (has) - { - // - // Style Object ... - iObj.BoxColor(rsiPeakPivotsColor); - iObj.BoxWidth(rsiPeakPivotsWidth); - iObj.BoxStyle(rsiPeakPivotsStyle); - - // - // Store Object ... - mRSIPeakPivotObjects.Add(iObj); - } // iBox.Clean(); - ZeroMemory(iObj); } } @@ -635,13 +774,6 @@ class XCXCAEAPOIDrawer : public XCBase return; } - // - if (ignoreUpdateOSCTos) - { - to = NULL; - } - bool canUpdateTo = IsValid(to); - // int count = detector.CountRSIValePivots(); for (int i = 0; i < count; i++) @@ -650,33 +782,13 @@ class XCXCAEAPOIDrawer : public XCBase XBoxZone iBox = detector.rsiValePivots[i]; // - if (canUpdateTo) - { - iBox.to = to; - } - - // - XCBoxObject *iObj; - has = drawer.DrawBox( + DrawRSIValePivot( iBox, - iObj // + to // ); - if (has) - { - // - // Style Object ... - iObj.BoxColor(rsiValePivotsColor); - iObj.BoxWidth(rsiValePivotsWidth); - iObj.BoxStyle(rsiValePivotsStyle); - - // - // Store Object ... - mRSIValePivotObjects.Add(iObj); - } // iBox.Clean(); - ZeroMemory(iObj); } } @@ -697,13 +809,6 @@ class XCXCAEAPOIDrawer : public XCBase return; } - // - if (ignoreUpdateOSCTos) - { - to = NULL; - } - bool canUpdateTo = IsValid(to); - // int count = detector.CountCCIPeakPivots(); for (int i = 0; i < count; i++) @@ -712,33 +817,13 @@ class XCXCAEAPOIDrawer : public XCBase XBoxZone iBox = detector.cciPeakPivots[i]; // - if (canUpdateTo) - { - iBox.to = to; - } - - // - XCBoxObject *iObj; - has = drawer.DrawBox( + DrawCCIPeakPivot( iBox, - iObj // + to // ); - if (has) - { - // - // Style Object ... - iObj.BoxColor(cciPeakPivotsColor); - iObj.BoxWidth(cciPeakPivotsWidth); - iObj.BoxStyle(cciPeakPivotsStyle); - - // - // Store Object ... - mCCIPeakPivotObjects.Add(iObj); - } // iBox.Clean(); - ZeroMemory(iObj); } } @@ -759,13 +844,6 @@ class XCXCAEAPOIDrawer : public XCBase return; } - // - if (ignoreUpdateOSCTos) - { - to = NULL; - } - bool canUpdateTo = IsValid(to); - // int count = detector.CountCCIValePivots(); for (int i = 0; i < count; i++) @@ -774,33 +852,13 @@ class XCXCAEAPOIDrawer : public XCBase XBoxZone iBox = detector.cciValePivots[i]; // - if (canUpdateTo) - { - iBox.to = to; - } - - // - XCBoxObject *iObj; - has = drawer.DrawBox( + DrawCCIValePivot( iBox, - iObj // + to // ); - if (has) - { - // - // Style Object ... - iObj.BoxColor(cciValePivotsColor); - iObj.BoxWidth(cciValePivotsWidth); - iObj.BoxStyle(cciValePivotsStyle); - - // - // Store Object ... - mCCIValePivotObjects.Add(iObj); - } // iBox.Clean(); - ZeroMemory(iObj); } } @@ -821,9 +879,6 @@ class XCXCAEAPOIDrawer : public XCBase return; } - // - bool canUpdateTo = IsValid(to); - // int count = detector.CountFVGBullishPivots(); for (int i = 0; i < count; i++) @@ -832,33 +887,13 @@ class XCXCAEAPOIDrawer : public XCBase XBoxZone iBox = detector.fvgBullishPivots[i]; // - if (canUpdateTo) - { - iBox.to = to; - } - - // - XCBoxObject *iObj; - has = drawer.DrawBox( + DrawFVGBullishPivot( iBox, - iObj // + to // ); - if (has) - { - // - // Style Object ... - iObj.BoxColor(fvgBullishPivotsColor); - iObj.BoxWidth(fvgBullishPivotsWidth); - iObj.BoxStyle(fvgBullishPivotsStyle); - - // - // Store Object ... - mFVGBullishPivotObjects.Add(iObj); - } // iBox.Clean(); - ZeroMemory(iObj); } } @@ -879,9 +914,6 @@ class XCXCAEAPOIDrawer : public XCBase return; } - // - bool canUpdateTo = IsValid(to); - // int count = detector.CountFVGBearishPivots(); for (int i = 0; i < count; i++) @@ -890,33 +922,13 @@ class XCXCAEAPOIDrawer : public XCBase XBoxZone iBox = detector.fvgBearishPivots[i]; // - if (canUpdateTo) - { - iBox.to = to; - } - - // - XCBoxObject *iObj; - has = drawer.DrawBox( + DrawFVGBearishPivot( iBox, - iObj // + to // ); - if (has) - { - // - // Style Object ... - iObj.BoxColor(fvgBearishPivotsColor); - iObj.BoxWidth(fvgBearishPivotsWidth); - iObj.BoxStyle(fvgBearishPivotsStyle); - - // - // Store Object ... - mFVGBearishPivotObjects.Add(iObj); - } // iBox.Clean(); - ZeroMemory(iObj); } } @@ -937,9 +949,6 @@ class XCXCAEAPOIDrawer : public XCBase return; } - // - bool canUpdateTo = IsValid(to); - // int count = detector.CountValeSupSWLPivots(); for (int i = 0; i < count; i++) @@ -948,33 +957,13 @@ class XCXCAEAPOIDrawer : public XCBase XBoxZone iBox = detector.valeSupSWLPivots[i]; // - if (canUpdateTo) - { - iBox.to = to; - } - - // - XCBoxObject *iObj; - has = drawer.DrawBox( + DrawValeSupSWLPivot( iBox, - iObj // + to // ); - if (has) - { - // - // Style Object ... - iObj.BoxColor(valeSupSWLPivotsColor); - iObj.BoxWidth(valeSupSWLPivotsWidth); - iObj.BoxStyle(valeSupSWLPivotsStyle); - - // - // Store Object ... - mValeSupSWLPivotObjects.Add(iObj); - } // iBox.Clean(); - ZeroMemory(iObj); } } @@ -995,9 +984,6 @@ class XCXCAEAPOIDrawer : public XCBase return; } - // - bool canUpdateTo = IsValid(to); - // int count = detector.CountPeakResSWHPivots(); for (int i = 0; i < count; i++) @@ -1006,33 +992,13 @@ class XCXCAEAPOIDrawer : public XCBase XBoxZone iBox = detector.peakResSWHPivots[i]; // - if (canUpdateTo) - { - iBox.to = to; - } - - // - XCBoxObject *iObj; - has = drawer.DrawBox( + DrawPeakResSWHPivot( iBox, - iObj // + to // ); - if (has) - { - // - // Style Object ... - iObj.BoxColor(peakResSWHPivotsColor); - iObj.BoxWidth(peakResSWHPivotsWidth); - iObj.BoxStyle(peakResSWHPivotsStyle); - - // - // Store Object ... - mPeakResSWHPivotObjects.Add(iObj); - } // iBox.Clean(); - ZeroMemory(iObj); } } @@ -1064,126 +1030,13 @@ class XCXCAEAPOIDrawer : public XCBase XCATRENDFVG iTrendFVG = detector.trendBullishPivots[i]; // - // Draw Trend Box ... - - // - if (canUpdateTo) - { - iTrendFVG.trend.to = to; - } - - // - XCBoxObject *iTrendBoxObj; - has = drawer.DrawBox( - iTrendFVG.trend, - iTrendBoxObj // + DrawTrendBullishPivot( + iTrendFVG, + to // ); - if (has) - { - // - // Style Object ... - iTrendBoxObj.BoxColor(trendBullishPivotsColor); - iTrendBoxObj.BoxWidth(trendBullishPivotsWidth); - iTrendBoxObj.BoxStyle(trendBullishPivotsStyle); - - // - // Store Object ... - mTrendBullishPivotObjects.Add(iTrendBoxObj); - } - - // - // Draw ITrendFVG FVGS ... - if (drawTrendPivotsOnlySelectedFVG) - { - // - XBoxZone iBox; - has = iTrendFVG.GetSelectedFVG(iBox); - if (!has) - { - // - iBox.Clean(); - continue; - } - - // - if (canUpdateTo) - { - iBox.to = to; - } - - // - XCBoxObject *iObj; - has = drawer.DrawBox( - iBox, - iObj // - ); - - // - if (has) - { - // - // Style Object ... - iObj.BoxColor(fvgBullishPivotsColor); - iObj.BoxWidth(fvgBullishPivotsWidth); - iObj.BoxStyle(fvgBullishPivotsStyle); - - // - // Store Object ... - mTrendBullishPivotObjects.Add(iObj); - } - - // - iBox.Clean(); - ZeroMemory(iObj); - } - else - { - // - // Draw All FVGs ... - has = HasChild(iTrendFVG.fvgs); - if (has) - { - // - int jCount = ArraySize(iTrendFVG.fvgs); - for (int j = 0; j < jCount; j++) - { - // - XBoxZone iBox = iTrendFVG.fvgs[j]; - - // - if (canUpdateTo) { - iBox.to = to; - } - - // - XCBoxObject *iObj; - has = drawer.DrawBox( - iBox, - iObj // - ); - if (has) - { - // - // Style Object ... - iObj.BoxColor(fvgBullishPivotsColor); - iObj.BoxWidth(fvgBullishPivotsWidth); - iObj.BoxStyle(fvgBullishPivotsStyle); - - // - // Store Object ... - mTrendBullishPivotObjects.Add(iObj); - } - - // - iBox.Clean(); - ZeroMemory(iObj); - } - } - } // iTrendFVG.Clean(); - ZeroMemory(iTrendBoxObj); } } @@ -1204,9 +1057,6 @@ class XCXCAEAPOIDrawer : public XCBase return; } - // - bool canUpdateTo = IsValid(to); - // int count = detector.CountTrendBearishPivots(); for (int i = 0; i < count; i++) @@ -1215,126 +1065,13 @@ class XCXCAEAPOIDrawer : public XCBase XCATRENDFVG iTrendFVG = detector.trendBearishPivots[i]; // - // Draw Trend Box ... - - // - if (canUpdateTo) - { - iTrendFVG.trend.to = to; - } - - // - XCBoxObject *iTrendBoxObj; - has = drawer.DrawBox( - iTrendFVG.trend, - iTrendBoxObj // + DrawTrendBearishPivot( + iTrendFVG, + to // ); - if (has) - { - // - // Style Object ... - iTrendBoxObj.BoxColor(trendBearishPivotsColor); - iTrendBoxObj.BoxWidth(trendBearishPivotsWidth); - iTrendBoxObj.BoxStyle(trendBearishPivotsStyle); - - // - // Store Object ... - mTrendBearishPivotObjects.Add(iTrendBoxObj); - } - - // - // Draw ITrendFVG FVGS ... - if (drawTrendPivotsOnlySelectedFVG) - { - // - XBoxZone iBox; - has = iTrendFVG.GetSelectedFVG(iBox); - if (!has) - { - // - iBox.Clean(); - continue; - } - - // - if (canUpdateTo) - { - iBox.to = to; - } - - // - XCBoxObject *iObj; - has = drawer.DrawBox( - iBox, - iObj // - ); - - // - if (has) - { - // - // Style Object ... - iObj.BoxColor(fvgBearishPivotsColor); - iObj.BoxWidth(fvgBearishPivotsWidth); - iObj.BoxStyle(fvgBearishPivotsStyle); - - // - // Store Object ... - mTrendBearishPivotObjects.Add(iObj); - } - - // - iBox.Clean(); - ZeroMemory(iObj); - } - else - { - // - // Draw All FVGs ... - has = HasChild(iTrendFVG.fvgs); - if (has) - { - // - int jCount = ArraySize(iTrendFVG.fvgs); - for (int j = 0; j < jCount; j++) - { - // - XBoxZone iBox = iTrendFVG.fvgs[j]; - - // - if (canUpdateTo) { - iBox.to = to; - } - - // - XCBoxObject *iObj; - has = drawer.DrawBox( - iBox, - iObj // - ); - if (has) - { - // - // Style Object ... - iObj.BoxColor(fvgBearishPivotsColor); - iObj.BoxWidth(fvgBearishPivotsWidth); - iObj.BoxStyle(fvgBearishPivotsStyle); - - // - // Store Object ... - mTrendBearishPivotObjects.Add(iObj); - } - - // - iBox.Clean(); - ZeroMemory(iObj); - } - } - } // iTrendFVG.Clean(); - ZeroMemory(iTrendBoxObj); } } @@ -1355,15 +1092,6 @@ class XCXCAEAPOIDrawer : public XCBase return; } - // - if (ignoreUpdateOSCTos) - { - to = NULL; - } - - // - bool canUpdateTo = IsValid(to); - // int count = detector.CountRSICrossedOverOSPivots(); for (int i = 0; i < count; i++) @@ -1372,35 +1100,13 @@ class XCXCAEAPOIDrawer : public XCBase XBoxZone iBox = detector.rsiCrossedOverOSPivots[i]; // - if (canUpdateTo) - { - iBox.to = to; - } - - // - XCBoxObject *iObj; - has = drawer.DrawBox( + DrawRSICrossedOverOSPivot( iBox, - iObj // + to // ); - // - if (has) - { - // - // Style Object ... - iObj.BoxColor(rsiCrossedOverOSPivotsColor); - iObj.BoxWidth(rsiCrossedOverOSPivotsWidth); - iObj.BoxStyle(rsiCrossedOverOSPivotsStyle); - - // - // Store Object ... - mRSICrossedOverOSPivotObjects.Add(iObj); - } - // iBox.Clean(); - ZeroMemory(iObj); } } @@ -1421,15 +1127,6 @@ class XCXCAEAPOIDrawer : public XCBase return; } - // - if (ignoreUpdateOSCTos) - { - to = NULL; - } - - // - bool canUpdateTo = IsValid(to); - // int count = detector.CountRSICrossedUnderOBPivots(); for (int i = 0; i < count; i++) @@ -1438,35 +1135,13 @@ class XCXCAEAPOIDrawer : public XCBase XBoxZone iBox = detector.rsiCrossedUnderOBPivots[i]; // - if (canUpdateTo) - { - iBox.to = to; - } - - // - XCBoxObject *iObj; - has = drawer.DrawBox( + DrawRSICrossedUnderOBPivot( iBox, - iObj // + to // ); - // - if (has) - { - // - // Style Object ... - iObj.BoxColor(rsiCrossedUnderOBPivotsColor); - iObj.BoxWidth(rsiCrossedUnderOBPivotsWidth); - iObj.BoxStyle(rsiCrossedUnderOBPivotsStyle); - - // - // Store Object ... - mRSICrossedUnderOBPivotObjects.Add(iObj); - } - // iBox.Clean(); - ZeroMemory(iObj); } } @@ -1487,15 +1162,6 @@ class XCXCAEAPOIDrawer : public XCBase return; } - // - if (ignoreUpdateOSCTos) - { - to = NULL; - } - - // - bool canUpdateTo = IsValid(to); - // int count = detector.CountCCICrossedOverOSPivots(); for (int i = 0; i < count; i++) @@ -1504,35 +1170,13 @@ class XCXCAEAPOIDrawer : public XCBase XBoxZone iBox = detector.cciCrossedOverOSPivots[i]; // - if (canUpdateTo) - { - iBox.to = to; - } - - // - XCBoxObject *iObj; - has = drawer.DrawBox( + DrawCCICrossedOverOSPivot( iBox, - iObj // + to // ); - // - if (has) - { - // - // Style Object ... - iObj.BoxColor(cciCrossedOverOSPivotsColor); - iObj.BoxWidth(cciCrossedOverOSPivotsWidth); - iObj.BoxStyle(cciCrossedOverOSPivotsStyle); - - // - // Store Object ... - mCCICrossedOverOSPivotObjects.Add(iObj); - } - // iBox.Clean(); - ZeroMemory(iObj); } } @@ -1553,21 +1197,627 @@ class XCXCAEAPOIDrawer : public XCBase return; } + // + int count = detector.CountCCICrossedUnderOBPivots(); + for (int i = 0; i < count; i++) + { + // + XBoxZone iBox = detector.cciCrossedUnderOBPivots[i]; + + // + DrawCCICrossedUnderOBPivot( + iBox, + to // + ); + + // + iBox.Clean(); + } + } + + // + // One Item Drawers ... + + // + void DrawTickPivot( + XBoxZone &item, + datetime to = NULL // + ) + { + // + bool has = drawTickPivots; + if (!has) + { + return; + } + + // + has = item.IsValid() && + item.type == GetBoxType(XCA_TICK); + if (!has) + { + return; + } + + // + bool canUpdateTo = IsValid(to); + if (canUpdateTo) + { + item.to = to; + } + + // + XCBoxObject *iObj; + has = drawer.DrawBox( + item, + iObj // + ); + if (has) + { + // + // Style Pivot ... + iObj.BoxColor(tickPivotsColor); + iObj.BoxWidth(tickPivotsWidth); + iObj.BoxStyle(tickPivotsStyle); + + // + // Store Pivot ... + mTickPivotObjects.Add(iObj); + } + + // + ZeroMemory(iObj); + } + + // + void DrawVolumePivot( + XBoxZone &item, + datetime to = NULL // + ) + { + // + bool has = drawVolumePivots; + if (!has) + { + return; + } + + // + has = item.IsValid() && + item.type == GetBoxType(XCA_VOLUME); + if (!has) + { + return; + } + + // + bool canUpdateTo = IsValid(to); + if (canUpdateTo) + { + item.to = to; + } + + // + XCBoxObject *iObj; + has = drawer.DrawBox( + item, + iObj // + ); + if (has) + { + // + // Style Pivot ... + iObj.BoxColor(volumePivotsColor); + iObj.BoxWidth(volumePivotsWidth); + iObj.BoxStyle(volumePivotsStyle); + + // + // Store Pivot ... + mVolumePivotObjects.Add(iObj); + } + + // + ZeroMemory(iObj); + } + + // + void DrawRSIPeakPivot( + XBoxZone &item, + datetime to = NULL // + ) + { + // + bool has = drawRSIPeakPivots; + if (!has) + { + return; + } + + // + has = item.IsValid() && + item.type == GetBoxType(XCA_RSI_PEAK) && + item.dir == GetDirection(XCA_RSI_PEAK); + if (!has) + { + return; + } + // if (ignoreUpdateOSCTos) { to = NULL; } + bool canUpdateTo = IsValid(to); + if (canUpdateTo) + { + item.to = to; + } + + // + XCBoxObject *iObj; + has = drawer.DrawBox( + item, + iObj // + ); + if (has) + { + // + // Style Object ... + iObj.BoxColor(rsiPeakPivotsColor); + iObj.BoxWidth(rsiPeakPivotsWidth); + iObj.BoxStyle(rsiPeakPivotsStyle); + + // + // Store Object ... + mRSIPeakPivotObjects.Add(iObj); + } + + // + ZeroMemory(iObj); + } + + // + void DrawRSIValePivot( + XBoxZone &item, + datetime to = NULL // + ) + { + // + bool has = drawRSIValePivots; + if (!has) + { + return; + } + + // + has = item.IsValid() && + item.type == GetBoxType(XCA_RSI_VALE) && + item.dir == GetDirection(XCA_RSI_VALE); + if (!has) + { + return; + } + + // + if (ignoreUpdateOSCTos) + { + to = NULL; + } + bool canUpdateTo = IsValid(to); + if (canUpdateTo) + { + item.to = to; + } + + // + XCBoxObject *iObj; + has = drawer.DrawBox( + item, + iObj // + ); + if (has) + { + // + // Style Object ... + iObj.BoxColor(rsiValePivotsColor); + iObj.BoxWidth(rsiValePivotsWidth); + iObj.BoxStyle(rsiValePivotsStyle); + + // + // Store Object ... + mRSIValePivotObjects.Add(iObj); + } + + // + ZeroMemory(iObj); + } + + // + void DrawCCIPeakPivot( + XBoxZone &item, + datetime to = NULL // + ) + { + // + bool has = drawCCIPeakPivots; + if (!has) + { + return; + } + + // + has = item.IsValid() && + item.type == GetBoxType(XCA_CCI_PEAK) && + item.dir == GetDirection(XCA_CCI_PEAK); + if (!has) + { + return; + } + + // + if (ignoreUpdateOSCTos) + { + to = NULL; + } + bool canUpdateTo = IsValid(to); + if (canUpdateTo) + { + item.to = to; + } + + // + XCBoxObject *iObj; + has = drawer.DrawBox( + item, + iObj // + ); + if (has) + { + // + // Style Object ... + iObj.BoxColor(cciPeakPivotsColor); + iObj.BoxWidth(cciPeakPivotsWidth); + iObj.BoxStyle(cciPeakPivotsStyle); + + // + // Store Object ... + mCCIPeakPivotObjects.Add(iObj); + } + + // + ZeroMemory(iObj); + } + + // + void DrawCCIValePivot( + XBoxZone &item, + datetime to = NULL // + ) + { + // + bool has = drawCCIValePivots; + if (!has) + { + return; + } + + // + has = item.IsValid() && + item.type == GetBoxType(XCA_CCI_VALE) && + item.dir == GetDirection(XCA_CCI_VALE); + if (!has) + { + return; + } + + // + if (ignoreUpdateOSCTos) + { + to = NULL; + } + bool canUpdateTo = IsValid(to); + if (canUpdateTo) + { + item.to = to; + } + + // + XCBoxObject *iObj; + has = drawer.DrawBox( + item, + iObj // + ); + if (has) + { + // + // Style Object ... + iObj.BoxColor(cciValePivotsColor); + iObj.BoxWidth(cciValePivotsWidth); + iObj.BoxStyle(cciValePivotsStyle); + + // + // Store Object ... + mCCIValePivotObjects.Add(iObj); + } + + // + ZeroMemory(iObj); + } + + // + void DrawFVGBullishPivot( + XBoxZone &item, + datetime to = NULL // + ) + { + // + bool has = drawFVGBullishPivots; + if (!has) + { + return; + } + + // + has = item.IsValid() && + item.type == GetBoxType(XCA_FVG_BULL) && + item.dir == GetDirection(XCA_FVG_BULL); + if (!has) + { + return; + } + + // + bool canUpdateTo = IsValid(to); + if (canUpdateTo) + { + item.to = to; + } + + // + XCBoxObject *iObj; + has = drawer.DrawBox( + item, + iObj // + ); + if (has) + { + // + // Style Object ... + iObj.BoxColor(fvgBullishPivotsColor); + iObj.BoxWidth(fvgBullishPivotsWidth); + iObj.BoxStyle(fvgBullishPivotsStyle); + + // + // Store Object ... + mFVGBullishPivotObjects.Add(iObj); + } + + // + ZeroMemory(iObj); + } + + // + void DrawFVGBearishPivot( + XBoxZone &item, + datetime to = NULL // + ) + { + // + bool has = drawFVGBearishPivots; + if (!has) + { + return; + } + + // + has = item.IsValid() && + item.type == GetBoxType(XCA_FVG_BEAR) && + item.dir == GetDirection(XCA_FVG_BEAR); + if (!has) + { + return; + } + + // + bool canUpdateTo = IsValid(to); + if (canUpdateTo) + { + item.to = to; + } + + // + XCBoxObject *iObj; + has = drawer.DrawBox( + item, + iObj // + ); + if (has) + { + // + // Style Object ... + iObj.BoxColor(fvgBearishPivotsColor); + iObj.BoxWidth(fvgBearishPivotsWidth); + iObj.BoxStyle(fvgBearishPivotsStyle); + + // + // Store Object ... + mFVGBearishPivotObjects.Add(iObj); + } + + // + ZeroMemory(iObj); + } + + // + void DrawValeSupSWLPivot( + XBoxZone &item, + datetime to = NULL // + ) + { + // + bool has = drawValeSupSWLPivots; + if (!has) + { + return; + } + + // + has = item.IsValid() && + item.type == GetBoxType(XCA_VALESWLSUP) && + item.dir == GetDirection(XCA_VALESWLSUP); + if (!has) + { + return; + } + + // + bool canUpdateTo = IsValid(to); + if (canUpdateTo) + { + item.to = to; + } + + // + XCBoxObject *iObj; + has = drawer.DrawBox( + item, + iObj // + ); + if (has) + { + // + // Style Object ... + iObj.BoxColor(valeSupSWLPivotsColor); + iObj.BoxWidth(valeSupSWLPivotsWidth); + iObj.BoxStyle(valeSupSWLPivotsStyle); + + // + // Store Object ... + mValeSupSWLPivotObjects.Add(iObj); + } + + // + ZeroMemory(iObj); + } + + // + void DrawPeakResSWHPivot( + XBoxZone &item, + datetime to = NULL // + ) + { + // + bool has = drawPeakResSWHPivots; + if (!has) + { + return; + } + + // + has = item.IsValid() && + item.type == GetBoxType(XCA_PEAKSWHRES) && + item.dir == GetDirection(XCA_PEAKSWHRES); + if (!has) + { + return; + } + + // + bool canUpdateTo = IsValid(to); + if (canUpdateTo) + { + item.to = to; + } + + // + XCBoxObject *iObj; + has = drawer.DrawBox( + item, + iObj // + ); + if (has) + { + // + // Style Object ... + iObj.BoxColor(peakResSWHPivotsColor); + iObj.BoxWidth(peakResSWHPivotsWidth); + iObj.BoxStyle(peakResSWHPivotsStyle); + + // + // Store Object ... + mPeakResSWHPivotObjects.Add(iObj); + } + + // + ZeroMemory(iObj); + } + + // + void DrawTrendBullishPivot( + XCATRENDFVG &item, + datetime to = NULL // + ) + { + // + bool has = drawTrendBullishPivots; + if (!has) + { + return; + } + + // + has = item.IsValid() && + item.trend.type == GetBoxType(XCA_TREND_BULL) && + item.trend.dir == GetDirection(XCA_TREND_BULL); + if (!has) + { + return; + } // bool canUpdateTo = IsValid(to); // - int count = detector.CountCCICrossedUnderOBPivots(); - for (int i = 0; i < count; i++) + // Draw Trend Box ... + + // + if (canUpdateTo) + { + item.trend.to = to; + } + + // + XCBoxObject *iTrendBoxObj; + has = drawer.DrawBox( + item.trend, + iTrendBoxObj // + ); + if (has) { // - XBoxZone iBox = detector.cciCrossedUnderOBPivots[i]; + // Style Object ... + iTrendBoxObj.BoxColor(trendBullishPivotsColor); + iTrendBoxObj.BoxWidth(trendBullishPivotsWidth); + iTrendBoxObj.BoxStyle(trendBullishPivotsStyle); + + // + // Store Object ... + mTrendBullishPivotObjects.Add(iTrendBoxObj); + } + + // + // Draw ITrendFVG FVGS ... + if (drawTrendPivotsOnlySelectedFVG) + { + // + XBoxZone iBox; + has = item.GetSelectedFVG(iBox); + if (!has) + { + // + iBox.Clean(); + return; + } // if (canUpdateTo) @@ -1587,19 +1837,439 @@ class XCXCAEAPOIDrawer : public XCBase { // // Style Object ... - iObj.BoxColor(cciCrossedUnderOBPivotsColor); - iObj.BoxWidth(cciCrossedUnderOBPivotsWidth); - iObj.BoxStyle(cciCrossedUnderOBPivotsStyle); + iObj.BoxColor(fvgBullishPivotsColor); + iObj.BoxWidth(fvgBullishPivotsWidth); + iObj.BoxStyle(fvgBullishPivotsStyle); // // Store Object ... - mCCICrossedUnderOBPivotObjects.Add(iObj); + mTrendBullishPivotObjects.Add(iObj); } // iBox.Clean(); ZeroMemory(iObj); } + else + { + // + // Draw All FVGs ... + has = HasChild(item.fvgs); + if (has) + { + // + int jCount = ArraySize(item.fvgs); + for (int j = 0; j < jCount; j++) + { + // + XBoxZone iBox = item.fvgs[j]; + + // + if (canUpdateTo) + { + iBox.to = to; + } + + // + XCBoxObject *iObj; + has = drawer.DrawBox( + iBox, + iObj // + ); + if (has) + { + // + // Style Object ... + iObj.BoxColor(fvgBullishPivotsColor); + iObj.BoxWidth(fvgBullishPivotsWidth); + iObj.BoxStyle(fvgBullishPivotsStyle); + + // + // Store Object ... + mTrendBullishPivotObjects.Add(iObj); + } + + // + iBox.Clean(); + ZeroMemory(iObj); + } + } + } + + // + ZeroMemory(iTrendBoxObj); + } + + // + void DrawTrendBearishPivot( + XCATRENDFVG &item, + datetime to = NULL // + ) + { + // + bool has = drawTrendBearishPivots; + if (!has) + { + return; + } + + // + has = item.IsValid() && + item.trend.type == GetBoxType(XCA_TREND_BEAR) && + item.trend.dir == GetDirection(XCA_TREND_BEAR); + if (!has) + { + return; + } + + // + bool canUpdateTo = IsValid(to); + + // + // Draw Trend Box ... + + // + if (canUpdateTo) + { + item.trend.to = to; + } + + // + XCBoxObject *iTrendBoxObj; + has = drawer.DrawBox( + item.trend, + iTrendBoxObj // + ); + if (has) + { + // + // Style Object ... + iTrendBoxObj.BoxColor(trendBearishPivotsColor); + iTrendBoxObj.BoxWidth(trendBearishPivotsWidth); + iTrendBoxObj.BoxStyle(trendBearishPivotsStyle); + + // + // Store Object ... + mTrendBearishPivotObjects.Add(iTrendBoxObj); + } + + // + // Draw ITrendFVG FVGS ... + if (drawTrendPivotsOnlySelectedFVG) + { + // + XBoxZone iBox; + has = item.GetSelectedFVG(iBox); + if (!has) + { + // + iBox.Clean(); + return; + } + + // + if (canUpdateTo) + { + iBox.to = to; + } + + // + XCBoxObject *iObj; + has = drawer.DrawBox( + iBox, + iObj // + ); + + // + if (has) + { + // + // Style Object ... + iObj.BoxColor(fvgBearishPivotsColor); + iObj.BoxWidth(fvgBearishPivotsWidth); + iObj.BoxStyle(fvgBearishPivotsStyle); + + // + // Store Object ... + mTrendBearishPivotObjects.Add(iObj); + } + + // + iBox.Clean(); + ZeroMemory(iObj); + } + else + { + // + // Draw All FVGs ... + has = HasChild(item.fvgs); + if (has) + { + // + int jCount = ArraySize(item.fvgs); + for (int j = 0; j < jCount; j++) + { + // + XBoxZone iBox = item.fvgs[j]; + + // + if (canUpdateTo) + { + iBox.to = to; + } + + // + XCBoxObject *iObj; + has = drawer.DrawBox( + iBox, + iObj // + ); + if (has) + { + // + // Style Object ... + iObj.BoxColor(fvgBearishPivotsColor); + iObj.BoxWidth(fvgBearishPivotsWidth); + iObj.BoxStyle(fvgBearishPivotsStyle); + + // + // Store Object ... + mTrendBearishPivotObjects.Add(iObj); + } + + // + iBox.Clean(); + ZeroMemory(iObj); + } + } + } + + // + ZeroMemory(iTrendBoxObj); + } + + // + void DrawRSICrossedOverOSPivot( + XBoxZone &item, + datetime to = NULL // + ) + { + // + bool has = drawRSICrossedOverOSPivots; + if (!has) + { + return; + } + + // + has = item.IsValid() && + item.type == GetBoxType(XCA_RSI_COOS) && + item.dir == GetDirection(XCA_RSI_COOS); + if (!has) + { + return; + } + + // + if (ignoreUpdateOSCTos) + { + to = NULL; + } + bool canUpdateTo = IsValid(to); + if (canUpdateTo) + { + item.to = to; + } + + // + XCBoxObject *iObj; + has = drawer.DrawBox( + item, + iObj // + ); + if (has) + { + // + // Style Object ... + iObj.BoxColor(rsiCrossedOverOSPivotsColor); + iObj.BoxWidth(rsiCrossedOverOSPivotsWidth); + iObj.BoxStyle(rsiCrossedOverOSPivotsStyle); + + // + // Store Object ... + mRSICrossedOverOSPivotObjects.Add(iObj); + } + + // + ZeroMemory(iObj); + } + + // + void DrawRSICrossedUnderOBPivot( + XBoxZone &item, + datetime to = NULL // + ) + { + // + bool has = drawRSICrossedUnderOBPivots; + if (!has) + { + return; + } + + // + has = item.IsValid() && + item.type == GetBoxType(XCA_RSI_CUOB) && + item.dir == GetDirection(XCA_RSI_CUOB); + if (!has) + { + return; + } + + // + if (ignoreUpdateOSCTos) + { + to = NULL; + } + bool canUpdateTo = IsValid(to); + if (canUpdateTo) + { + item.to = to; + } + + // + XCBoxObject *iObj; + has = drawer.DrawBox( + item, + iObj // + ); + if (has) + { + // + // Style Object ... + iObj.BoxColor(rsiCrossedUnderOBPivotsColor); + iObj.BoxWidth(rsiCrossedUnderOBPivotsWidth); + iObj.BoxStyle(rsiCrossedUnderOBPivotsStyle); + + // + // Store Object ... + mRSICrossedUnderOBPivotObjects.Add(iObj); + } + + // + ZeroMemory(iObj); + } + + // + void DrawCCICrossedOverOSPivot( + XBoxZone &item, + datetime to = NULL // + ) + { + // + bool has = drawCCICrossedOverOSPivots; + if (!has) + { + return; + } + + // + has = item.IsValid() && + item.type == GetBoxType(XCA_CCI_COOS) && + item.dir == GetDirection(XCA_CCI_COOS); + if (!has) + { + return; + } + + // + if (ignoreUpdateOSCTos) + { + to = NULL; + } + bool canUpdateTo = IsValid(to); + if (canUpdateTo) + { + item.to = to; + } + + // + XCBoxObject *iObj; + has = drawer.DrawBox( + item, + iObj // + ); + if (has) + { + // + // Style Object ... + iObj.BoxColor(cciCrossedOverOSPivotsColor); + iObj.BoxWidth(cciCrossedOverOSPivotsWidth); + iObj.BoxStyle(cciCrossedOverOSPivotsStyle); + + // + // Store Object ... + mCCICrossedOverOSPivotObjects.Add(iObj); + } + + // + ZeroMemory(iObj); + } + + // + void DrawCCICrossedUnderOBPivot( + XBoxZone &item, + datetime to = NULL // + ) + { + // + bool has = drawCCICrossedUnderOBPivots; + if (!has) + { + return; + } + + // + has = item.IsValid() && + item.type == GetBoxType(XCA_CCI_CUOB) && + item.dir == GetDirection(XCA_CCI_CUOB); + if (!has) + { + return; + } + + // + if (ignoreUpdateOSCTos) + { + to = NULL; + } + bool canUpdateTo = IsValid(to); + if (canUpdateTo) + { + item.to = to; + } + + // + XCBoxObject *iObj; + has = drawer.DrawBox( + item, + iObj // + ); + if (has) + { + // + // Style Object ... + iObj.BoxColor(cciCrossedUnderOBPivotsColor); + iObj.BoxWidth(cciCrossedUnderOBPivotsWidth); + iObj.BoxStyle(cciCrossedUnderOBPivotsStyle); + + // + // Store Object ... + mCCICrossedUnderOBPivotObjects.Add(iObj); + } + + // + ZeroMemory(iObj); } // diff --git a/XCAEA/Libraries/xcaea.signaller.lib.mq5 b/XCAEA/Libraries/xcaea.signaller.lib.mq5 index 299a9204..cabb7fb4 100644 --- a/XCAEA/Libraries/xcaea.signaller.lib.mq5 +++ b/XCAEA/Libraries/xcaea.signaller.lib.mq5 @@ -26,6 +26,7 @@ #include "../../Libraries/x-saherelm.x-poi.lib.mq5" #include "../../Libraries/x-saherelm.x-trade.lib.mq5" #include "../Classes/xcaea.x-poi.detector.class.mq5" +#include "../Classes/xcaea.x-poi.drawer.class.mq5" #include "../Helpers/xcaea.helper.mq5" // @@ -421,6 +422,7 @@ int AddGuard( // bool DetectXCAEAConditions( + XCXCAEAPOIDrawer *drawer, ENUM_X_DIRECTION trend, XBoxZone &pivots[], XCAEAConditions &conditions, @@ -761,6 +763,23 @@ bool DetectXCAEAConditions( // // Parsing Pivots ... + // + // Select Inside Boxes ... + XBoxZone insidePivots[]; + int insidePivotsCount = SelectInsideBoxes( + insidePivots, + pivots, + zBar, + cBar, + pBar, + p2Bar // + ); + bool hasInsidePivots = IsValidSize(insidePivotsCount); + if (hasInsidePivots) { + // + drawer.DrawBoxes(insidePivots, TimeCurrent()); + } + // // Detect Selected Pivot ... XBoxZone rejectedPivot; @@ -986,6 +1005,113 @@ bool DetectXCAEAConditions( return result; } +// +// Select Inside Boxes ... +int SelectInsideBoxes( + XBoxZone &insideBoxes[], + XBoxZone &boxes[], + XOHCL &zBar, + XOHCL &cBar, + XOHCL &pBar, + XOHCL &p2Bar // +) +{ + // + int result = 0; + + // + Clean(insideBoxes); + + // + bool has = + zBar.IsValid() && + cBar.IsValid() && + pBar.IsValid() && + p2Bar.IsValid() && + HasChild(boxes); + if (!has) + { + return result; + } + + // + int count = ArraySize(boxes); + for (int i = 0; i < count; i++) + { + // + XBoxZone iBox = boxes[i]; + + // + // Check Box Type ... + bool isTypePassed = + // + iBox.type == GetBoxType(XCA_TREND_BULL) || + iBox.type == GetBoxType(XCA_TREND_BEAR) + // + ; + if (!isTypePassed) + { + // + iBox.Clean(); + + // + continue; + } + + // + bool isBullish = iBox.IsBullish(); + bool isBearish = iBox.IsBearish(); + + // + // Check Inside Conditions ... + + // + bool isBullishInside = + // + isBullish && + // + ((cBar.low < iBox.upper && + cBar.low > iBox.lower) || + (cBar.GetDown() < iBox.upper && + cBar.GetDown() > iBox.lower)) + // + ; + + // + bool isBearishInside = + // + isBearish && + // + ((cBar.high > iBox.lower && + cBar.high < iBox.upper) || + (cBar.GetUp() > iBox.lower && + cBar.GetUp() < iBox.upper)) + // + ; + + // + has = isBullishInside || + isBearishInside; + if (has) + { + // + AddRef( + iBox, + insideBoxes // + ); + } + + // + iBox.Clean(); + } + + // + result = ArraySize(insideBoxes); + + // + return result; +} + // bool SelectRejectedBox( XBoxZone &box, diff --git a/XCAEA/Signals/xcaea.signaller.class.mq5 b/XCAEA/Signals/xcaea.signaller.class.mq5 index 83ed95f4..7e3ca784 100644 --- a/XCAEA/Signals/xcaea.signaller.class.mq5 +++ b/XCAEA/Signals/xcaea.signaller.class.mq5 @@ -206,7 +206,7 @@ class XCXCAEASignaller : XCBase // // Draw Founded Pivots ... - drawer.Draw(cTime); + // drawer.Draw(cTime); // // Retrieve Valid Pviots ... @@ -259,6 +259,7 @@ class XCXCAEASignaller : XCBase // // Detect Sinal Box ... hasSignalBox = DetectXCAEAConditions( + drawer, trend, pivots, conditions,