diff --git a/XCAEA/Classes/xcaea.x-poi.detector.class.mq5 b/XCAEA/Classes/xcaea.x-poi.detector.class.mq5 index 03fe7dee..124a1641 100644 --- a/XCAEA/Classes/xcaea.x-poi.detector.class.mq5 +++ b/XCAEA/Classes/xcaea.x-poi.detector.class.mq5 @@ -258,6 +258,7 @@ int ExtractPivots( // bool IsFakeBreakeout( XBoxZone &pivot, + XCXCAEAHelper *helper, int barIndex = 0 // ) { @@ -276,7 +277,7 @@ bool IsFakeBreakeout( // int fromIDX = pivot.FromIndex(); - result = barIndex > fromIDX; + result = barIndex < fromIDX; if (!result) { return result; @@ -313,6 +314,90 @@ bool IsFakeBreakeout( // return result; } + // + // Bars Conditions ... + + // + ENUM_X_DIRECTION cBarDir; + + // + // Hammer ... + bool isCBarHammer = helper + .barAnalyser + .IsHammer( + cBar, + cBarDir // + ); + bool isCBarBullishHammer = + isCBarHammer && + IsBullish(cBarDir); + bool isCBarBearishHammer = + isCBarHammer && + IsBearish(cBarDir); + + // + // Rejected ... + bool isCBarRejected = helper + .barAnalyser + .IsRejected( + cBar, + cBarDir, + false, // Force Type ... + true // Force Fibo Pressure ... + ); + bool isCBarBullishRejected = + isCBarRejected && + IsBullish(cBarDir); + bool isCBarBearishRejected = + isCBarRejected && + IsBearish(cBarDir); + + // + // Engulfed ... + bool isCBarEngulfed = helper + .barAnalyser + .IsEngulfed( + cBar, + cBarDir // + ); + bool isCBarBullishEngulfed = + isCBarEngulfed && + IsBullish(cBarDir); + bool isCBarBearishEngulfed = + isCBarEngulfed && + IsBearish(cBarDir); + + // + // Momentum ... + bool isCBarMomentum = helper + .barAnalyser + .IsMomentum( + cBar, + cBarDir, + 1 // + ); + bool isCBarBullishMomentum = + isCBarMomentum && + IsBullish(cBarDir); + bool isCBarBearishMomentum = + isCBarMomentum && + IsBearish(cBarDir); + + // + bool isCBarHasBullishPower = isCBarBullishRejected || + isCBarBullishEngulfed || + isCBarBullishMomentum; + + // + bool isCBarHasBearishPower = isCBarBearishRejected || + isCBarBearishEngulfed || + isCBarBearishMomentum; + + // + bool isBarPowerfull = + isBullish + ? isCBarHasBullishPower + : isCBarHasBearishPower; // double breakPrice = @@ -321,6 +406,7 @@ bool IsFakeBreakeout( : pivot.upper; // + // CBar Must Go back InSide Box ... bool isBarInside = cBar.GetUp() > breakPrice && cBar.GetDown() < breakPrice && @@ -330,7 +416,10 @@ bool IsFakeBreakeout( result = // // Bar Must Inside Pivot ... - isBarInside + isBarInside && + // + // Bar Must Has Required Direction Power ... + isBarPowerfull // ; diff --git a/XCAEA/Libraries/xcaea.signaller.lib.mq5 b/XCAEA/Libraries/xcaea.signaller.lib.mq5 index 18c08149..ba51c5ce 100644 --- a/XCAEA/Libraries/xcaea.signaller.lib.mq5 +++ b/XCAEA/Libraries/xcaea.signaller.lib.mq5 @@ -1076,6 +1076,8 @@ bool DetectXCAEAConditions( // // Parsing Pivots ... + XBoxZone upperPivot; + XBoxZone lowerPivot; double providedSL = 0; XBoxZone rejectedPivot; XBoxZone insidePivots[]; @@ -1135,6 +1137,7 @@ bool DetectXCAEAConditions( allowedFakeBreakedPivots, fakeBreakedPivot, pivots, + helper, zBar, cBar, pBar, @@ -1146,6 +1149,30 @@ bool DetectXCAEAConditions( // Print("Faked Breaked Box Detected ..."); } + + // + // Select Boundary Boxes ... + ENUM_XCA_PIVOTS allowedBoundarydPivots[] = { + XCA_PEAK, + XCA_VALE, + }; + has = SelectBoundaryBoxes( + allowedBoundarydPivots, + upperPivot, + lowerPivot, + pivots, + helper, + zBar, + cBar, + pBar, + p2Bar // + ); + Clean(allowedBoundarydPivots); + if (has) + { + // + Print("Boundary Pivots Detected ..."); + } } // @@ -1431,6 +1458,8 @@ bool DetectXCAEAConditions( p2Bar.Clean(); p3Bar.Clean(); p4Bar.Clean(); + upperPivot.Clean(); + lowerPivot.Clean(); Clean(cTrendValues); Clean(pTrendValues); Clean(insidePivots); @@ -1702,6 +1731,7 @@ bool SelectFakeBreakedBox( ENUM_XCA_PIVOTS &allowedTypes[], XBoxZone &box, XBoxZone &boxes[], + XCXCAEAHelper *helper, XOHCL &zBar, XOHCL &cBar, XOHCL &pBar, @@ -1776,6 +1806,7 @@ bool SelectFakeBreakedBox( // Check Box Fake Breakeout ... result = IsFakeBreakeout( iBox, + helper, cBar.Index() // ); if (result) @@ -1800,6 +1831,124 @@ bool SelectFakeBreakedBox( return result; } +// +bool SelectBoundaryBoxes( + ENUM_XCA_PIVOTS &allowedTypes[], + XBoxZone &upperBox, + XBoxZone &lowerBox, + XBoxZone &boxes[], + XCXCAEAHelper *helper, + XOHCL &zBar, + XOHCL &cBar, + XOHCL &pBar, + XOHCL &p2Bar // +) +{ + // + bool result = false; + + // + upperBox.Clean(); + lowerBox.Clean(); + + // + // Validate ... + result = + zBar.IsValid() && + cBar.IsValid() && + pBar.IsValid() && + p2Bar.IsValid() && + HasChild(boxes); + if (!result) + { + return result; + } + + // + XBoxZone tmp[]; + Copy( + boxes, + tmp // + ); + + // + int idx = -1; + XBoxZone iBox; + while (HasChild(tmp)) + { + // + idx = GetYoungest(tmp); + result = IsValidIndex(idx); + if (!result) + { + break; + } + + // + iBox = tmp[idx]; + ArrayRemove( + tmp, + idx, + 1 // + ); + + // + // Checking Box Type Allowed ... + ENUM_XCA_PIVOTS iType = GetPivotType(iBox); + result = IsValid(iType) && + (!HasChild(allowedTypes) + ? true + : Contains( + iType, + allowedTypes // + )); + if (!result) + { + // + iBox.Clean(); + continue; + } + + // + // Upper ... + bool canSetUpper = + iType == XCA_PEAK && + (!upperBox.IsValid() + ? true + : upperBox.lower > iBox.lower); + if (canSetUpper) + { + upperBox = iBox; + } + + // + // Lower ... + bool canSetLower = + iType == XCA_VALE && + (!lowerBox.IsValid() + ? true + : lowerBox.upper < iBox.upper); + if (canSetLower) + { + lowerBox = iBox; + } + + // + iBox.Clean(); + } + + // + Clean(tmp); + iBox.Clean(); + + // + result = upperBox.IsValid() && + lowerBox.IsValid(); + + // + return result; +} + // int ExtractValues( double &values[],