diff --git a/Classes/x-saherelm.x-market.pattern.class.mq5 b/Classes/x-saherelm.x-market.pattern.class.mq5 index 07cf9999..a2be7acb 100644 --- a/Classes/x-saherelm.x-market.pattern.class.mq5 +++ b/Classes/x-saherelm.x-market.pattern.class.mq5 @@ -1660,6 +1660,97 @@ class XCMarketPatternDetector : public XCBase return result; } + bool HasCandlestickDirection( + XOHCL &bar, + ENUM_X_DIRECTION forDir, + bool checkStarPattern = true, + bool checkPinBarPattern = true, + bool checkPiercingPattern = true, + bool checkEngulfedPattern = true, + bool checkSignalKeyBarPattern = true // + ) + { + // + bool result = false; + + // + // Validate ... + result = bar.IsValid() && + HasDirection(forDir); + if (!result) + { + return result; + } + + // + ENUM_X_DIRECTION tmpDir = X_DIRECTION_NONE; + + // + // Star ... + bool isStarPattern = false; + if (checkStarPattern) + { + // + isStarPattern = + IsStarPattern(bar, tmpDir) && + tmpDir == forDir; + } + + // + bool isPiercingPattern = false; + if (checkPiercingPattern) + { + // + isPiercingPattern = + IsPiercingPattern(bar, tmpDir) && + tmpDir == forDir; + } + + // + // Engulfed ... + bool isEngulfedPattern = false; + if (checkEngulfedPattern) + { + // + isEngulfedPattern = + IsEngulfedBar(bar, tmpDir) && + tmpDir == forDir; + } + + // + // PinBar ... + bool isPinBarPattern = true; + if (checkPinBarPattern) + { + // + isPinBarPattern = + IsPinnedBar(bar, tmpDir) && + tmpDir == forDir; + } + + // + // Signal Key Bar ... + bool isSignalKeyBarPattern = false; + if (checkSignalKeyBarPattern) + { + // + isSignalKeyBarPattern = + IsSignalKeyBarPattern(bar, tmpDir) && + tmpDir == forDir; + } + + // + result = + isStarPattern || + isPinBarPattern || + isPiercingPattern || + isEngulfedPattern || + isSignalKeyBarPattern; + + // + return result; + } + /** * Detect Order Flow ... * @@ -4332,7 +4423,7 @@ class XCMarketPatternDetector : public XCBase bool containsFVGs = true, bool containsSupports = true, bool containsResistancess = true, - int loopback = 500, + int loopback = 500, ENUM_X_DIRECTION forDir = X_DIRECTION_NONE, ENUM_X_SORT_BY sortBy = X_SORT_BY_DATE, ENUM_X_DIRECTION sortDir = X_DIRECTION_BEARISH, diff --git a/Documents/Diagrams/MQL5.X121XKI.Board.kanban b/Documents/Diagrams/MQL5.X121XKI.Board.kanban index fe234be4..4df7b501 100644 --- a/Documents/Diagrams/MQL5.X121XKI.Board.kanban +++ b/Documents/Diagrams/MQL5.X121XKI.Board.kanban @@ -44,7 +44,7 @@ { "id": "6104db5f-95b2-401a-9efd-354b685e7a5f", "title": "Reversal POI", - "checked": false + "checked": true }, { "id": "05aaad69-af4d-4253-89a7-e46a80cae593", diff --git a/X121XKIEA/Classes/x-saherelm.x121.xki.parser.class.mq5 b/X121XKIEA/Classes/x-saherelm.x121.xki.parser.class.mq5 index d183e700..d6a04265 100644 --- a/X121XKIEA/Classes/x-saherelm.x121.xki.parser.class.mq5 +++ b/X121XKIEA/Classes/x-saherelm.x121.xki.parser.class.mq5 @@ -890,12 +890,12 @@ class XCX121XKIHelperParser : XCBase { return result; } - + // - double atr = helper.GetATR(barIndex); - double atrMa = helper.GetATRSmoothed(barIndex); + double atr = helper.GetATR(barIndex); + double atrMa = helper.GetATRSmoothed(barIndex); result = atr > atrMa; - + // return result; } @@ -918,8 +918,8 @@ class XCX121XKIHelperParser : XCBase } // - double atr = helper.GetATR(barIndex); - double atrMa = helper.GetATRSmoothed(barIndex); + double atr = helper.GetATR(barIndex); + double atrMa = helper.GetATRSmoothed(barIndex); result = atr < atrMa; // @@ -1234,7 +1234,29 @@ class XCX121XKIHelperParser : XCBase } // - result = IsKIWaveSwitchedToBullish(barIndex) && IsRSIOversold(barIndex); + // RSI oversold and turning upward ... + double rsiNow = helper.GetRSI(barIndex); + double rsiPrev = helper.GetRSI(barIndex + 1); + bool rsiFlip = (rsiNow > rsiPrev) && (rsiPrev < 30); + + // + // ATR check (volatility supportive) ... + double atrNow = helper.GetATR(barIndex); + double atrPrev = helper.GetATR(barIndex + 1); + double atrMaNow = helper.GetATRSmoothed(barIndex); + double atrMaPrev = helper.GetATRSmoothed(barIndex + 1); + bool atrOk = atrNow > atrMaNow || atrNow > atrPrev || atrMaNow > atrMaPrev; + + // + // MA crossover bullish ... + double maFastNow = helper.GetMAFast(barIndex); + double maSlowNow = helper.GetMASlow(barIndex); + bool maOk = maFastNow > maSlowNow; + + // + result = rsiFlip && (atrOk || maOk); + + // return result; } @@ -1256,7 +1278,29 @@ class XCX121XKIHelperParser : XCBase } // - result = IsKIWaveSwitchedToBearish(barIndex) && IsRSIOverbought(barIndex); + // RSI overbought and turning downward ... + double rsiNow = helper.GetRSI(barIndex); + double rsiPrev = helper.GetRSI(barIndex + 1); + bool rsiFlip = (rsiNow < rsiPrev) && (rsiPrev > 70); + + // + // ATR check (volatility supportive) ... + double atrNow = helper.GetATR(barIndex); + double atrPrev = helper.GetATR(barIndex + 1); + double atrMaNow = helper.GetATRSmoothed(barIndex); + double atrMaPrev = helper.GetATRSmoothed(barIndex + 1); + bool atrOk = atrNow > atrMaNow || atrNow > atrPrev || atrMaNow > atrMaPrev; + + // + // MA crossover bearish ... + double maFastNow = helper.GetMAFast(barIndex); + double maSlowNow = helper.GetMASlow(barIndex); + bool maOk = maFastNow < maSlowNow; + + // + result = rsiFlip && (atrOk || maOk); + + // return result; } diff --git a/X121XKIEA/Classes/x-saherelm.x121.xki.signaller.class.mq5 b/X121XKIEA/Classes/x-saherelm.x121.xki.signaller.class.mq5 index bfe28aeb..00628192 100644 --- a/X121XKIEA/Classes/x-saherelm.x121.xki.signaller.class.mq5 +++ b/X121XKIEA/Classes/x-saherelm.x121.xki.signaller.class.mq5 @@ -954,13 +954,13 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller IsXBullish(dir); bool isBearishReversalPOI = isReversalPOI && IsXBearish(dir); - isSafe = (isBullishReversalPOI && isSafeForBullishEntry) || - (isBearishReversalPOI && isSafeForBearishEntry); - if (isReversalPOI && isSafe) + isSafe = (isBullishReversalPOI && isSafeForBearishEntry) || + (isBearishReversalPOI && isSafeForBullishEntry); + if (isReversalPOI) { - // - Print("isReversalPOI: ", ToXString(dir)); - DebugBreak(); + // // + // Print("isReversalPOI: ", ToXString(dir)); + // DebugBreak(); } // diff --git a/X121XKIEA/Classes/x-saherelm.x121.xki.x-poi.detector.class.mq5 b/X121XKIEA/Classes/x-saherelm.x121.xki.x-poi.detector.class.mq5 index e890cff0..7514c8c8 100644 --- a/X121XKIEA/Classes/x-saherelm.x121.xki.x-poi.detector.class.mq5 +++ b/X121XKIEA/Classes/x-saherelm.x121.xki.x-poi.detector.class.mq5 @@ -658,10 +658,12 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector return result; } + // + DebugBreak(); + // // Add candlestick confirmation ... XOHCL bar; - ENUM_X_DIRECTION dir; result = result && bar.Init(symbol, period, barIndex); if (!result) @@ -671,8 +673,10 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector // result = result && - IsStarPattern(bar, dir) && - IsXBullish(dir); + HasCandlestickDirection( + bar, + X_DIRECTION_BULLISH // + ); // bar.Clean(); @@ -696,10 +700,12 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector return result; } + // + DebugBreak(); + // // Add candlestick confirmation ... XOHCL bar; - ENUM_X_DIRECTION dir; result = result && bar.Init(symbol, period, barIndex); if (!result) @@ -709,8 +715,10 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector // result = result && - IsStarPattern(bar, dir) && - IsXBearish(dir); + HasCandlestickDirection( + bar, + X_DIRECTION_BEARISH // + ); // bar.Clean(); diff --git a/x-mql-project.tools.js b/x-mql-project.tools.js index 468f36c1..25534e6d 100644 --- a/x-mql-project.tools.js +++ b/x-mql-project.tools.js @@ -24,10 +24,10 @@ const workspacePaths = [ "Helpers", // Indicator's Helpers Classes "Indicators", // Required Indicators "Libraries", // Required Libraries - "X121KIEA", // X121KIEA Projects ... - "XCATBEA", // XCATBEA Projects ... "XOM1EA", // XOM1EA Projects ... "XFIMAEA", // XOM1EA Projects ... + "XCATBEA", // XCATBEA Projects ... + "X121XKIEA", // X121XKIEA Projects ... ]; // @@ -493,5 +493,5 @@ module.exports = { cleanupWorkSpace, compileWorkSpace, prepareProject -} +}; //#endregion \ No newline at end of file