diff --git a/XCAEA/Classes/xcaea.x-poi.detector.class.mq5 b/XCAEA/Classes/xcaea.x-poi.detector.class.mq5 index de1805ca..de5522fa 100644 --- a/XCAEA/Classes/xcaea.x-poi.detector.class.mq5 +++ b/XCAEA/Classes/xcaea.x-poi.detector.class.mq5 @@ -4506,6 +4506,54 @@ class XCXCAEAPOIDetector : public XCBase } } + // + has = HasRSICrossedOverOSPivots(); + if (has) { + // + count = CountRSICrossedOverOSPivots(); + for (int i = 0; i < count; i++) + { + // + XBoxZone iBox; + has = rsiCrossedOverOSPivots[i].AsBox(iBox); + if (has) + { + // + AddRef( + iBox, + boxes // + ); + } + + // + iBox.Clean(); + } + } + + // + has = HasCCICrossedOverOSPivots(); + if (has) { + // + count = CountCCICrossedOverOSPivots(); + for (int i = 0; i < count; i++) + { + // + XBoxZone iBox; + has = cciCrossedOverOSPivots[i].AsBox(iBox); + if (has) + { + // + AddRef( + iBox, + boxes // + ); + } + + // + iBox.Clean(); + } + } + // result = ArraySize(boxes); @@ -4803,6 +4851,54 @@ class XCXCAEAPOIDetector : public XCBase } } + // + has = HasRSICrossedUnderOBPivots(); + if (has) { + // + count = CountRSICrossedUnderOBPivots(); + for (int i = 0; i < count; i++) + { + // + XBoxZone iBox; + has = rsiCrossedUnderOBPivots[i].AsBox(iBox); + if (has) + { + // + AddRef( + iBox, + boxes // + ); + } + + // + iBox.Clean(); + } + } + + // + has = HasCCICrossedUnderOBPivots(); + if (has) { + // + count = CountCCICrossedUnderOBPivots(); + for (int i = 0; i < count; i++) + { + // + XBoxZone iBox; + has = cciCrossedUnderOBPivots[i].AsBox(iBox); + if (has) + { + // + AddRef( + iBox, + boxes // + ); + } + + // + iBox.Clean(); + } + } + // result = ArraySize(boxes); diff --git a/XCAEA/Libraries/xcaea.signaller.lib.mq5 b/XCAEA/Libraries/xcaea.signaller.lib.mq5 index 778123b3..8a6b571f 100644 --- a/XCAEA/Libraries/xcaea.signaller.lib.mq5 +++ b/XCAEA/Libraries/xcaea.signaller.lib.mq5 @@ -24,6 +24,7 @@ #include "../../Libraries/x-saherelm.common.lib.mq5" #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 "../Helpers/xcaea.helper.mq5" // @@ -431,6 +432,11 @@ bool DetectXCAEAConditions( // bool result = false; + // + int idx = -1; + int count = 0; + bool has = false; + // box.Clean(); conditions.Clean(); @@ -464,15 +470,15 @@ bool DetectXCAEAConditions( int zIDX = barIndex; int cIDX = zIDX + 1; int pIDX = cIDX + 1; - int ppIDX = pIDX + 1; - int p3IDX = ppIDX + 1; + int p2IDX = pIDX + 1; + int p3IDX = p2IDX + 1; int p4IDX = p3IDX + 1; // XOHCL zBar; XOHCL cBar; XOHCL pBar; - XOHCL ppBar; + XOHCL p2Bar; XOHCL p3Bar; XOHCL p4Bar; result = zBar.Init( @@ -488,10 +494,10 @@ bool DetectXCAEAConditions( cBar.GetPreviousBar(pBar); result = result && - pBar.GetPreviousBar(ppBar); + pBar.GetPreviousBar(p2Bar); result = result && - ppBar.GetPreviousBar(p3Bar); + p2Bar.GetPreviousBar(p3Bar); result = result && p3Bar.GetPreviousBar(p4Bar); @@ -501,7 +507,7 @@ bool DetectXCAEAConditions( zBar.Clean(); cBar.Clean(); pBar.Clean(); - ppBar.Clean(); + p2Bar.Clean(); p3Bar.Clean(); p4Bar.Clean(); @@ -513,6 +519,146 @@ bool DetectXCAEAConditions( return result; } + // + bool isBarBullishVPattern = + pBar.IsBullish() && + cBar.low > pBar.low && + p2Bar.low > pBar.low; + + // + bool isBarBearishVPattern = + pBar.IsBearish() && + cBar.high < pBar.high && + p2Bar.high < pBar.high; + + // + // Detect Selected Box ... + XBoxZone selectedBox; + bool hasBoxes = HasChild(boxes); + if (hasBoxes) + { + // + // Detect Selected Boxes ... + XBoxZone tmp[]; + Copy( + boxes, + tmp // + ); + while (HasChild(tmp)) + { + // + idx = GetYoungest(tmp); + has = IsValidIndex(idx); + if (!has) + { + break; + } + + // + XBoxZone iBox; + iBox = tmp[idx]; + ArrayRemove( + tmp, + idx, + 1 // + ); + + // + // Check Selected Box not RSI or CCI ... + has = iBox.type == ToString(XCA_PEAKSWHRES) || + iBox.type == ToString(XCA_VALESWLSUP); + if (!has) + { + continue; + } + + // + bool isBullish = iBox.IsBullish(); + bool isBearish = iBox.IsBearish(); + + // + double rejectedCheckPrice = + isBullish + ? iBox.upper + : iBox.lower; + + // + // Check Box Selecting Senarios ... + + // + // Selecting Rejected Boxes ... + bool isRejected = cBar.IsRejected( + rejectedCheckPrice, + iBox.dir, + false, + false // + ); + + // + // Selecting Activation Boxes ... + + // + bool isBullishActivated = + isBullish && + isBarBullishVPattern && + cBar.GetUp() > rejectedCheckPrice && + cBar.GetDown() < rejectedCheckPrice; + + // + bool isBearishActivated = + isBearish && + isBarBearishVPattern && + cBar.GetUp() > rejectedCheckPrice && + cBar.GetDown() < rejectedCheckPrice; + + // + bool isActivated = isBullishActivated || + isBearishActivated; + + // + has = // isRejected || + isActivated; + if (has) + { + // + selectedBox = iBox; + + // + iBox.Clean(); + break; + } + + // + iBox.Clean(); + } + + // + Clean(tmp); + } + + // + // Force Conditions to Have Selected Box ... + result = hasBoxes && + selectedBox.IsValid(); + if (!result) + { + // + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + p2Bar.Clean(); + p3Bar.Clean(); + p4Bar.Clean(); + + // + box.Clean(); + conditions.Clean(); + selectedBox.Clean(); + + // + return result; + } + // // Bars Conditions ... @@ -635,12 +781,12 @@ bool DetectXCAEAConditions( // double cKI = conditions.kiBuffer[cIDX]; double pKI = conditions.kiBuffer[pIDX]; - double p2KI = conditions.kiBuffer[ppIDX]; + double p2KI = conditions.kiBuffer[p2IDX]; // double cKIState = conditions.kiStateBuffer[cIDX]; double pKIState = conditions.kiStateBuffer[pIDX]; - double p2KIState = conditions.kiStateBuffer[ppIDX]; + double p2KIState = conditions.kiStateBuffer[p2IDX]; // // TKI ... @@ -648,12 +794,12 @@ bool DetectXCAEAConditions( // double cTKI = conditions.tkiBuffer[cIDX]; double pTKI = conditions.tkiBuffer[pIDX]; - double p2TKI = conditions.tkiBuffer[ppIDX]; + double p2TKI = conditions.tkiBuffer[p2IDX]; // double cTKIState = conditions.tkiStateBuffer[cIDX]; double pTKIState = conditions.tkiStateBuffer[pIDX]; - double p2TKIState = conditions.tkiStateBuffer[ppIDX]; + double p2TKIState = conditions.tkiStateBuffer[p2IDX]; // // TREND ... @@ -661,12 +807,12 @@ bool DetectXCAEAConditions( // double cTrend = conditions.trendBuffer[cIDX]; double pTrend = conditions.trendBuffer[pIDX]; - double p2Trend = conditions.trendBuffer[ppIDX]; + double p2Trend = conditions.trendBuffer[p2IDX]; // double ctrendState = conditions.trendStateBuffer[cIDX]; double ptrendState = conditions.trendStateBuffer[pIDX]; - double p2trendState = conditions.trendStateBuffer[ppIDX]; + double p2trendState = conditions.trendStateBuffer[p2IDX]; // // SWING Low ... @@ -674,7 +820,7 @@ bool DetectXCAEAConditions( // double cSWL = conditions.swingLowBuffer[cIDX]; double pSWL = conditions.swingLowBuffer[pIDX]; - double p2SWL = conditions.swingLowBuffer[ppIDX]; + double p2SWL = conditions.swingLowBuffer[p2IDX]; // // SWING High ... @@ -682,7 +828,7 @@ bool DetectXCAEAConditions( // double cSWH = conditions.swingHighBuffer[cIDX]; double pSWH = conditions.swingHighBuffer[pIDX]; - double p2SWH = conditions.swingHighBuffer[ppIDX]; + double p2SWH = conditions.swingHighBuffer[p2IDX]; // // PEAK ... @@ -690,7 +836,7 @@ bool DetectXCAEAConditions( // double cPeak = conditions.peakBuffer[cIDX]; double pPeak = conditions.peakBuffer[pIDX]; - double p2Peak = conditions.peakBuffer[ppIDX]; + double p2Peak = conditions.peakBuffer[p2IDX]; // // VALE ... @@ -698,7 +844,7 @@ bool DetectXCAEAConditions( // double cVale = conditions.valeBuffer[cIDX]; double pVale = conditions.valeBuffer[pIDX]; - double p2Vale = conditions.valeBuffer[ppIDX]; + double p2Vale = conditions.valeBuffer[p2IDX]; // // COMPLEX ... @@ -856,7 +1002,7 @@ bool DetectXCAEAConditions( zBar.Clean(); cBar.Clean(); pBar.Clean(); - ppBar.Clean(); + p2Bar.Clean(); p3Bar.Clean(); p4Bar.Clean(); diff --git a/XCAEA/Signals/xcaea.signaller.class.mq5 b/XCAEA/Signals/xcaea.signaller.class.mq5 index c046f2ef..12da4a59 100644 --- a/XCAEA/Signals/xcaea.signaller.class.mq5 +++ b/XCAEA/Signals/xcaea.signaller.class.mq5 @@ -191,12 +191,14 @@ class XCXCAEASignaller : XCBase // // Bullish ... XBoxZone bullishBoxes[]; - int bullishBoxesCount = detector.FillBullishBoxes(bullishBoxes); + int bullishBoxesCount = detector + .FillBullishBoxes(bullishBoxes); // // Bearish ... XBoxZone bearishBoxes[]; - int bearishBoxesCount = detector.FillBearishBoxes(bearishBoxes); + int bearishBoxesCount = detector + .FillBearishBoxes(bearishBoxes); // XBoxZone boxes[]; @@ -631,7 +633,7 @@ class XCXCAEASignaller : XCBase // // Oscillators Views ... - inputs.showCCI = true; + inputs.showCCI = false; inputs.showRSI = false; inputs.showMFI = false; inputs.showRVI = false; @@ -657,20 +659,20 @@ class XCXCAEASignaller : XCBase detector.detectValePivot = false; detector.detectKIBullishPivot = false; detector.detectKIBearishPivot = false; - detector.detectPeakSWHResPivot = false; // true; - detector.detectValeSWLSupPivot = false; // true; + detector.detectPeakSWHResPivot = true; + detector.detectValeSWLSupPivot = true; detector.detectTKIBullishPivot = false; detector.detectCycleSameLLPivot = false; detector.detectCycleSameHHPivot = false; detector.detectTKIBearishPivot = false; - detector.detectTrendBullishPivot = false; // true; - detector.detectTrendBearishPivot = false; // true; + detector.detectTrendBullishPivot = true; + detector.detectTrendBearishPivot = true; detector.detectTKITRNDBullishPivot = false; detector.detectTKITRNDBearishPivot = false; detector.detectRSICrossedOverOSPivot = true; detector.detectRSICrossedUnderOBPivot = true; detector.detectCCICrossedOverOSPivot = true; - detector.detectCCICrossedUnderOBPivot = true; + detector.detectCCICrossedUnderOBPivot = true; // // Initialize and Configure Drawer ... @@ -695,9 +697,9 @@ class XCXCAEASignaller : XCBase drawer.drawTKITRNDBullishPivots = false; drawer.drawTKITRNDBearishPivots = false; drawer.drawRSICrossedOverOSPivots = true; - drawer.drawRSICrossedUnderOBPivots = true; + drawer.drawRSICrossedUnderOBPivots = true; drawer.drawCCICrossedOverOSPivots = true; - drawer.drawCCICrossedUnderOBPivots = true; + drawer.drawCCICrossedUnderOBPivots = true; } /**