diff --git a/Classes/x-saherelm.x-market.pattern.class.mq5 b/Classes/x-saherelm.x-market.pattern.class.mq5 index a2be7acb..826d1c5b 100644 --- a/Classes/x-saherelm.x-market.pattern.class.mq5 +++ b/Classes/x-saherelm.x-market.pattern.class.mq5 @@ -1667,6 +1667,7 @@ class XCMarketPatternDetector : public XCBase bool checkPinBarPattern = true, bool checkPiercingPattern = true, bool checkEngulfedPattern = true, + bool checkMomentumPattern = true, bool checkSignalKeyBarPattern = true // ) { @@ -1739,12 +1740,24 @@ class XCMarketPatternDetector : public XCBase tmpDir == forDir; } + // + // Momentum Bar ... + bool isMomentumBarPattern = false; + if (checkMomentumPattern) + { + // + isMomentumBarPattern = + IsMomentumBar(bar, tmpDir) && + tmpDir == forDir; + } + // result = isStarPattern || isPinBarPattern || isPiercingPattern || isEngulfedPattern || + isMomentumBarPattern || isSignalKeyBarPattern; // diff --git a/Documents/BKP/X121XKI/tmps.bkp.mq5 b/Documents/BKP/X121XKI/tmps.bkp.mq5 index ee8df269..8194f44f 100644 --- a/Documents/BKP/X121XKI/tmps.bkp.mq5 +++ b/Documents/BKP/X121XKI/tmps.bkp.mq5 @@ -583,3 +583,381 @@ // return result; } + + /** + * Check Bar Has Signal Based on Strategy 1 ... + * + * Pattern‑based reversal: + * - Detects Pin Bar or Signal Key Bar. + * - Confirms with POI detector. + * - Good for reversals at support/resistance. + * + * @param bar: XOHCL, reference to Bar ... + * @param zone: XBoxZone, reference to holds affected zone ... + * @param targets: XTarget, reference to detected Signal's Targets collections ... + * @param dir: ENUM_X_DIRECTION, detected Signal's direction ... + * + * @return ( bool ) + */ + bool Strategy1HasSignal( + XOHCL &bar, + XBoxZone &zone, + XTarget &targets[], + ENUM_X_DIRECTION &dir // + ) + { + // + bool result = false; + + // + zone.Clean(); + XClean(targets); + dir = X_DIRECTION_NONE; + + // + result = bar.IsValid(); + if (!result) + { + return result; + } + + // + int barIndex = bar.Index() + 1; + + // + // Safe for Entry ... + bool isSafeForBullishEntry = kiParser.IsSafeBullishEntry(barIndex); + bool isSafeForBearishEntry = kiParser.IsSafeBearishEntry(barIndex); + + // + // POI ... + bool isPOI = poiDetector.IsPOI(dir, barIndex); + bool isBullishPOI = isPOI && + IsXBullish(dir); + bool isBearishPOI = isPOI && + IsXBearish(dir); + if (isPOI) + { + // + // Print("isPOI: ", ToXString(dir)); + // DebugBreak(); + } + + // + // Breakout POI ... + bool isBreakoutPOI = poiDetector.IsBreakoutPOI(dir, barIndex); + bool isBullishBreakoutPOI = isBreakoutPOI && + IsXBullish(dir); + bool isBearishBreakoutPOI = isBreakoutPOI && + IsXBearish(dir); + if (isBreakoutPOI) + { + // + // Print("isBreakoutPOI: ", ToXString(dir)); + // DebugBreak(); + } + + // + // Reversal POI ... + bool isReversalPOI = poiDetector.IsReversalPOI(dir, barIndex); + bool isBullishReversalPOI = isReversalPOI && + IsXBullish(dir); + bool isBearishReversalPOI = isReversalPOI && + IsXBearish(dir); + if (isReversalPOI) + { + // // + // Print("isReversalPOI: ", ToXString(dir)); + // DebugBreak(); + } + + // + // Continuation POI ... + bool isContinuationPOI = poiDetector.IsContinuationPOI(dir, barIndex); + bool isBullishContinuationPOI = isContinuationPOI && + IsXBullish(dir); + bool isBearishContinuationPOI = isContinuationPOI && + IsXBearish(dir); + if (isContinuationPOI) + { + // + // Print("isContinuationPOI: ", ToXString(dir)); + // DebugBreak(); + } + + // + // Exhaustion POI ... + bool isExhaustionPOI = poiDetector.IsExhaustionPOI(dir, barIndex); + bool isBullishExhaustionPOI = isExhaustionPOI && + IsXBullish(dir); + bool isBearishExhaustionPOI = isExhaustionPOI && + IsXBearish(dir); + if (isExhaustionPOI) + { + // + // Print("isExhaustionPOI: ", ToXString(dir)); + // DebugBreak(); + } + + // + // TrendExhausted POI ... + bool isTrendExhaustedPOI = poiDetector.IsTrendExhaustedPOI(dir, barIndex); + bool isBullishTrendExhaustedPOI = isTrendExhaustedPOI && + IsXBullish(dir); + bool isBearishTrendExhaustedPOI = isTrendExhaustedPOI && + IsXBearish(dir); + if (isTrendExhaustedPOI) + { + // + Print("isTrendExhaustedPOI: ", ToXString(dir)); + DebugBreak(); + } + + + /** + * Check Bar Has Signal Based on Strategy 2 ... + * + * Trend‑following: + * - Requires KI Fast + KI Slow alignment. + * - Confirms with MA crossover. + * - RSI filter to avoid false signals. + * + * @return ( bool ) + */ + bool Strategy2HasSignal( + XOHCL &bar, + XBoxZone &zone, + XTarget &targets[], + ENUM_X_DIRECTION &dir // + ) + { + // + bool result = false; + + // + zone.Clean(); + XClean(targets); + dir = X_DIRECTION_NONE; + + // + result = bar.IsValid(); + if (!result) + { + return result; + } + + // + int barIndex = bar.Index() + 1; + + // + bool isBullish = kiParser.IsBullishMomentumTrend(bar.Index()); + bool isBearish = kiParser.IsBearishMomentumTrend(bar.Index()); + result = isBullish || + isBearish; + if (!result) + { + return result; + } + + // + dir = isBullish + ? X_DIRECTION_BULLISH + : isBearish + ? X_DIRECTION_BEARISH + : X_DIRECTION_NONE; + result = ToBox(bar, zone, dir, X_BAR_PATTERN_MOMENTUM); + result = + result && + zone.IsValid() && + HasDirection(dir); + + // + return result; + } + + /** + * Check Bar Has Signal Based on Strategy 3 ... + * + * Breakout: + * - Detects price breaking KI bands with ATR confirmation. + * - Confirms with Momentum Bar pattern. + * + * @return ( bool ) + */ + bool Strategy3HasSignal( + XOHCL &bar, + XBoxZone &zone, + XTarget &targets[], + ENUM_X_DIRECTION &dir // + ) + { + // + bool result = false; + + // + zone.Clean(); + XClean(targets); + dir = X_DIRECTION_NONE; + + // + result = bar.IsValid(); + if (!result) + { + return result; + } + + // + bool isBullish = poiDetector.IsBullishBreakoutPOI(bar.Index()); + bool isBearish = poiDetector.IsBearishBreakoutPOI(bar.Index()); + result = isBullish || + isBearish; + if (!result) + { + return result; + } + + // + dir = isBullish + ? X_DIRECTION_BULLISH + : isBearish + ? X_DIRECTION_BEARISH + : X_DIRECTION_NONE; + result = ToBox(bar, zone, dir, X_BAR_PATTERN_TRUE_GAPED); + result = + result && + zone.IsValid() && + HasDirection(dir); + + // + return result; + } + + /** + * Check Bar Has Signal Based on Strategy 4 ... + * + * Exhaustion: + * - Strong trend + RSI extreme + volatility low. + * - Confirms with Piercing/Dark Cloud Cover candlestick. + * + * @return ( bool ) + */ + bool Strategy4HasSignal( + XOHCL &bar, + XBoxZone &zone, + XTarget &targets[], + ENUM_X_DIRECTION &dir // + ) + { + // + bool result = false; + + // + zone.Clean(); + XClean(targets); + dir = X_DIRECTION_NONE; + + // + result = bar.IsValid(); + if (!result) + { + return result; + } + + // + bool isBullish = poiDetector.IsBullishTrendExhaustedPOI(bar.Index()); + bool isBearish = poiDetector.IsBearishTrendExhaustedPOI(bar.Index()); + result = isBullish || + isBearish; + if (!result) + { + return result; + } + + // + dir = isBullish + ? X_DIRECTION_BULLISH + : isBearish + ? X_DIRECTION_BEARISH + : X_DIRECTION_NONE; + result = ToBox(bar, zone, dir, X_BAR_PATTERN_PIERCING); + result = + result && + zone.IsValid() && + HasDirection(dir); + + // + return result; + } + + /** + * Check Bar Has Signal Based on Strategy 5 ... + * + * Continuation: + * - Requires strong trend confirmation (KI fast/slow + MA crossover + RSI filter). + * - Confirms with continuation candlestick patterns (Flag or Rising pattern). + * - Ensures zone validity for entry. + * + * @return ( bool ) + */ + bool Strategy5HasSignal( + XOHCL &bar, + XBoxZone &zone, + XTarget &targets[], + ENUM_X_DIRECTION &dir // + ) + { + // + bool result = false; + + // + zone.Clean(); + XClean(targets); + dir = X_DIRECTION_NONE; + + // + result = bar.IsValid(); + if (!result) + { + return result; + } + + // + bool isBullish = kiParser.IsTrendStrongBullish(bar.Index()); + bool isBearish = kiParser.IsTrendStrongBearish(bar.Index()); + result = isBullish || + isBearish; + if (!result) + { + return result; + } + + // + // Confirm Direction by Candlestick Continuation Patterns ... + isBullish = + isBullish && + poiDetector.IsBullishContinuationPOI(bar.Index()); + isBearish = + isBearish && + poiDetector.IsBearishContinuationPOI(bar.Index()); + result = isBullish || + isBearish; + if (!result) + { + return result; + } + + // + dir = isBullish + ? X_DIRECTION_BULLISH + : isBearish + ? X_DIRECTION_BEARISH + : X_DIRECTION_NONE; + result = ToBox(bar, zone, dir, X_BAR_PATTERN_PIERCING); + result = + result && + zone.IsValid() && + HasDirection(dir); + + // + return result; + } diff --git a/Documents/Diagrams/MQL5.X121XKI.Board.kanban b/Documents/Diagrams/MQL5.X121XKI.Board.kanban index 4df7b501..11c11f02 100644 --- a/Documents/Diagrams/MQL5.X121XKI.Board.kanban +++ b/Documents/Diagrams/MQL5.X121XKI.Board.kanban @@ -13,58 +13,7 @@ { "id": "6f8db3d6-fcaa-4522-bee5-0e3e38c96e73", "title": "Doing", - "cards": [ - { - "id": "1b86f94a-a66e-482c-9172-c9dbb338bb63", - "listId": "6f8db3d6-fcaa-4522-bee5-0e3e38c96e73", - "title": "Testing POI(s) for Strategies ...", - "description": "we have some POIs in POI Detectors ...\nin this task we have to test them Works ...", - "labels": [], - "checkboxes": [ - { - "id": "224b6c66-341f-4dda-aa25-6b45ab034a6e", - "title": "Add Support Testing them;", - "checked": true - }, - { - "id": "50caaa08-a3a4-4be5-85d8-4ab41e8dd945", - "title": "Add Support for Safe Entry;", - "checked": true - }, - { - "id": "95ee0eba-4e0d-4a6a-be62-93aa562ab767", - "title": "POI", - "checked": true - }, - { - "id": "aec8ebe5-0d88-4ea7-bfd3-eb1a26af8a55", - "title": "Breakout POI", - "checked": true - }, - { - "id": "6104db5f-95b2-401a-9efd-354b685e7a5f", - "title": "Reversal POI", - "checked": true - }, - { - "id": "05aaad69-af4d-4253-89a7-e46a80cae593", - "title": "Continuation POI", - "checked": true - }, - { - "id": "a7a75d64-00dd-4004-bab2-5040a47b8441", - "title": "Exhaustion POI", - "checked": false - }, - { - "id": "a9c52b07-9a50-4c30-abf9-cd8e3febb6aa", - "title": "TrendExhausted POI", - "checked": false - } - ], - "comments": [] - } - ] + "cards": [] }, { "id": "c6b07a7f-d2e7-4f67-a5a9-0d93cd8bf981", @@ -119,6 +68,61 @@ "comment": "here we are going to test changes ..." } ] + }, + { + "id": "1b86f94a-a66e-482c-9172-c9dbb338bb63", + "listId": "c6b07a7f-d2e7-4f67-a5a9-0d93cd8bf981", + "title": "Testing POI(s) for Strategies ...", + "description": "we have some POIs in POI Detectors ...\nin this task we have to test them Works ...", + "labels": [], + "checkboxes": [ + { + "id": "224b6c66-341f-4dda-aa25-6b45ab034a6e", + "title": "Add Support Testing them;", + "checked": true + }, + { + "id": "50caaa08-a3a4-4be5-85d8-4ab41e8dd945", + "title": "Add Support for Safe Entry;", + "checked": true + }, + { + "id": "95ee0eba-4e0d-4a6a-be62-93aa562ab767", + "title": "POI", + "checked": true + }, + { + "id": "aec8ebe5-0d88-4ea7-bfd3-eb1a26af8a55", + "title": "Breakout POI", + "checked": true + }, + { + "id": "6104db5f-95b2-401a-9efd-354b685e7a5f", + "title": "Reversal POI", + "checked": true + }, + { + "id": "05aaad69-af4d-4253-89a7-e46a80cae593", + "title": "Continuation POI", + "checked": true + }, + { + "id": "a7a75d64-00dd-4004-bab2-5040a47b8441", + "title": "Exhaustion POI", + "checked": true + }, + { + "id": "a9c52b07-9a50-4c30-abf9-cd8e3febb6aa", + "title": "TrendExhausted POI", + "checked": true + } + ], + "comments": [ + { + "id": "cbcb5bf5-898d-4f5a-88bc-55007a11244c", + "comment": "all POI(s) noe well tested ...\nand everythings ready for implementing Strategies ..." + } + ] } ] }, diff --git a/Helpers/x-saherelm.x121.xki.helper.mq5 b/Helpers/x-saherelm.x121.xki.helper.mq5 index c97b61f7..ddfcb3e4 100644 --- a/Helpers/x-saherelm.x121.xki.helper.mq5 +++ b/Helpers/x-saherelm.x121.xki.helper.mq5 @@ -54,7 +54,7 @@ enum ENUM_X121_XKI_BUFFERS // // ATR ... X121_XKI_ATR_LINE = 11, - X121_XKI_ATR_SMOOTHED_LINE = 17, + X121_XKI_ATR_SMOOTHED_LINE = 18, X121_XKI_ATR_RAW_UPPER_LINE = 12, X121_XKI_ATR_RAW_LOWER_LINE = 13, // diff --git a/X121XKIEA/Classes/x-saherelm.x121.xki.signaller.class.mq5 b/X121XKIEA/Classes/x-saherelm.x121.xki.signaller.class.mq5 index 00628192..5fff5575 100644 --- a/X121XKIEA/Classes/x-saherelm.x121.xki.signaller.class.mq5 +++ b/X121XKIEA/Classes/x-saherelm.x121.xki.signaller.class.mq5 @@ -909,108 +909,6 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller // int barIndex = bar.Index() + 1; - // - // Safe for Entry ... - bool isSafe = false; - bool isSafeForBullishEntry = kiParser.IsSafeBullishEntry(barIndex); - bool isSafeForBearishEntry = kiParser.IsSafeBearishEntry(barIndex); - - // - // POI ... - bool isPOI = poiDetector.IsPOI(dir, barIndex); - bool isBullishPOI = isPOI && - IsXBullish(dir); - bool isBearishPOI = isPOI && - IsXBearish(dir); - isSafe = (isBullishPOI && isSafeForBullishEntry) || - (isBearishPOI && isSafeForBearishEntry); - if (isPOI && isSafe) - { - // - // Print("isPOI: ", ToXString(dir)); - // DebugBreak(); - } - - // - // Breakout POI ... - bool isBreakoutPOI = poiDetector.IsBreakoutPOI(dir, barIndex); - bool isBullishBreakoutPOI = isBreakoutPOI && - IsXBullish(dir); - bool isBearishBreakoutPOI = isBreakoutPOI && - IsXBearish(dir); - isSafe = (isBullishBreakoutPOI && isSafeForBullishEntry) || - (isBearishBreakoutPOI && isSafeForBearishEntry); - if (isBreakoutPOI && isSafe) - { - // - // Print("isBreakoutPOI: ", ToXString(dir)); - // DebugBreak(); - } - - // - // Reversal POI ... - bool isReversalPOI = poiDetector.IsReversalPOI(dir, barIndex); - bool isBullishReversalPOI = isReversalPOI && - IsXBullish(dir); - bool isBearishReversalPOI = isReversalPOI && - IsXBearish(dir); - isSafe = (isBullishReversalPOI && isSafeForBearishEntry) || - (isBearishReversalPOI && isSafeForBullishEntry); - if (isReversalPOI) - { - // // - // Print("isReversalPOI: ", ToXString(dir)); - // DebugBreak(); - } - - // - // Continuation POI ... - bool isContinuationPOI = poiDetector.IsContinuationPOI(dir, barIndex); - bool isBullishContinuationPOI = isContinuationPOI && - IsXBullish(dir); - bool isBearishContinuationPOI = isContinuationPOI && - IsXBearish(dir); - isSafe = (isBullishContinuationPOI && isSafeForBullishEntry) || - (isBearishContinuationPOI && isSafeForBearishEntry); - if (isContinuationPOI && isSafe) - { - // - // Print("isContinuationPOI: ", ToXString(dir)); - // DebugBreak(); - } - - // - // Exhaustion POI ... - bool isExhaustionPOI = poiDetector.IsExhaustionPOI(dir, barIndex); - bool isBullishExhaustionPOI = isExhaustionPOI && - IsXBullish(dir); - bool isBearishExhaustionPOI = isExhaustionPOI && - IsXBearish(dir); - isSafe = (isBullishExhaustionPOI && isSafeForBullishEntry) || - (isBearishExhaustionPOI && isSafeForBearishEntry); - if (isExhaustionPOI && isSafe) - { - // - Print("isExhaustionPOI: ", ToXString(dir)); - DebugBreak(); - } - - // - // TrendExhausted POI ... - bool isTrendExhaustedPOI = poiDetector.IsTrendExhaustedPOI(dir, barIndex); - bool isBullishTrendExhaustedPOI = isTrendExhaustedPOI && - IsXBullish(dir); - bool isBearishTrendExhaustedPOI = isTrendExhaustedPOI && - IsXBearish(dir); - isSafe = (isBullishTrendExhaustedPOI && isSafeForBullishEntry) || - (isBearishTrendExhaustedPOI && isSafeForBearishEntry); - if (isTrendExhaustedPOI && isSafe) - { - // - Print("isTrendExhaustedPOI: ", ToXString(dir)); - DebugBreak(); - } - // result = result && @@ -1054,22 +952,9 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller } // - bool isBullish = kiParser.IsBullishMomentumTrend(bar.Index()); - bool isBearish = kiParser.IsBearishMomentumTrend(bar.Index()); - result = isBullish || - isBearish; - if (!result) - { - return result; - } + int barIndex = bar.Index() + 1; // - dir = isBullish - ? X_DIRECTION_BULLISH - : isBearish - ? X_DIRECTION_BEARISH - : X_DIRECTION_NONE; - result = ToBox(bar, zone, dir, X_BAR_PATTERN_MOMENTUM); result = result && zone.IsValid() && @@ -1111,22 +996,9 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller } // - bool isBullish = poiDetector.IsBullishBreakoutPOI(bar.Index()); - bool isBearish = poiDetector.IsBearishBreakoutPOI(bar.Index()); - result = isBullish || - isBearish; - if (!result) - { - return result; - } + int barIndex = bar.Index() + 1; // - dir = isBullish - ? X_DIRECTION_BULLISH - : isBearish - ? X_DIRECTION_BEARISH - : X_DIRECTION_NONE; - result = ToBox(bar, zone, dir, X_BAR_PATTERN_TRUE_GAPED); result = result && zone.IsValid() && @@ -1168,22 +1040,9 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller } // - bool isBullish = poiDetector.IsBullishTrendExhaustedPOI(bar.Index()); - bool isBearish = poiDetector.IsBearishTrendExhaustedPOI(bar.Index()); - result = isBullish || - isBearish; - if (!result) - { - return result; - } + int barIndex = bar.Index() + 1; // - dir = isBullish - ? X_DIRECTION_BULLISH - : isBearish - ? X_DIRECTION_BEARISH - : X_DIRECTION_NONE; - result = ToBox(bar, zone, dir, X_BAR_PATTERN_PIERCING); result = result && zone.IsValid() && @@ -1226,37 +1085,9 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller } // - bool isBullish = kiParser.IsTrendStrongBullish(bar.Index()); - bool isBearish = kiParser.IsTrendStrongBearish(bar.Index()); - result = isBullish || - isBearish; - if (!result) - { - return result; - } + int barIndex = bar.Index() + 1; // - // Confirm Direction by Candlestick Continuation Patterns ... - isBullish = - isBullish && - poiDetector.IsBullishContinuationPOI(bar.Index()); - isBearish = - isBearish && - poiDetector.IsBearishContinuationPOI(bar.Index()); - result = isBullish || - isBearish; - if (!result) - { - return result; - } - - // - dir = isBullish - ? X_DIRECTION_BULLISH - : isBearish - ? X_DIRECTION_BEARISH - : X_DIRECTION_NONE; - result = ToBox(bar, zone, dir, X_BAR_PATTERN_PIERCING); result = result && zone.IsValid() && 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 7514c8c8..cf72cad2 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,9 +658,6 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector return result; } - // - DebugBreak(); - // // Add candlestick confirmation ... XOHCL bar; @@ -700,9 +697,6 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector return result; } - // - DebugBreak(); - // // Add candlestick confirmation ... XOHCL bar; @@ -886,8 +880,9 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector barIndex = kiParser.NormalizeBarIndex(barIndex); // - result = kiParser.IsTrendStrongBullish(barIndex) && - kiParser.IsRSIOverbought(barIndex); + bool isTrendOk = kiParser.IsTrendStrongBullish(barIndex); + bool isRSIOk = kiParser.IsRSIOverbought(barIndex); + result = isTrendOk && isRSIOk; if (!result) { return result; @@ -896,7 +891,6 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector // // Add candlestick confirmation ... XOHCL bar; - ENUM_X_DIRECTION dir; result = result && bar.Init(symbol, period, barIndex); if (!result) @@ -906,8 +900,10 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector // result = result && - IsPiercingPattern(bar, dir) && - IsXBullish(dir); + HasCandlestickDirection( + bar, + X_DIRECTION_BEARISH // + ); // bar.Clean(); @@ -925,8 +921,9 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector barIndex = kiParser.NormalizeBarIndex(barIndex); // - result = kiParser.IsTrendStrongBearish(barIndex) && - kiParser.IsRSIOversold(barIndex); + bool isTrendOk = kiParser.IsTrendStrongBearish(barIndex); + bool isRSIOk = kiParser.IsRSIOversold(barIndex); + result = isTrendOk && isRSIOk; if (!result) { return result; @@ -935,7 +932,6 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector // // Add candlestick confirmation ... XOHCL bar; - ENUM_X_DIRECTION dir; result = result && bar.Init(symbol, period, barIndex); if (!result) @@ -945,8 +941,10 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector // result = result && - IsPiercingPattern(bar, dir) && - IsXBearish(dir); + HasCandlestickDirection( + bar, + X_DIRECTION_BULLISH // + ); // bar.Clean(); @@ -999,9 +997,33 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector barIndex = kiParser.NormalizeBarIndex(barIndex); // - result = kiParser.IsTrendStrongBullish(barIndex) && - kiParser.IsVolatilityLow(barIndex) && - kiParser.IsRSIOverbought(barIndex); + // Trend was strong in last 3 bars ... + bool isTrendOk = kiParser.IsTrendStrongBullish(barIndex + 1); + for (int i = 1; i <= 3; i++) + { + // + if (kiParser.IsTrendStrongBullish(barIndex + i)) + { + isTrendOk = true; + break; + } + } + + // + // RSI rolling over from overbought ... + double rsiNow = kiHelper.GetRSI(barIndex); + double rsiPrev = kiHelper.GetRSI(barIndex + 1); + bool rsiFlip = (rsiPrev > 70 && rsiNow < rsiPrev); + bool isRSIOk = rsiFlip || kiParser.IsRSIOverbought(barIndex); + + // + bool volCooling = kiHelper.GetATR(barIndex) <= kiHelper.GetATRSmoothed(barIndex) * 1.05; + bool isVolatilityOk = volCooling || kiParser.IsVolatilityLow(barIndex); + + // + result = isRSIOk && + isTrendOk && + isVolatilityOk; if (!result) { return result; @@ -1010,7 +1032,6 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector // // Add candlestick confirmation ... XOHCL bar; - ENUM_X_DIRECTION dir; result = result && bar.Init(symbol, period, barIndex); if (!result) @@ -1020,8 +1041,10 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector // result = result && - IsPiercingPattern(bar, dir) && - IsXBullish(dir); + HasCandlestickDirection( + bar, + X_DIRECTION_BEARISH // + ); // bar.Clean(); @@ -1039,9 +1062,32 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector barIndex = kiParser.NormalizeBarIndex(barIndex); // - result = kiParser.IsTrendStrongBearish(barIndex) && - kiParser.IsVolatilityLow(barIndex) && - kiParser.IsRSIOversold(barIndex); + bool isTrendOk = kiParser.IsTrendStrongBearish(barIndex + 1); + for (int i = 1; i <= 3; i++) + { + // + if (kiParser.IsTrendStrongBearish(barIndex + i)) + { + isTrendOk = true; + break; + } + } + + // + // RSI rolling over from overbought ... + double rsiNow = kiHelper.GetRSI(barIndex); + double rsiPrev = kiHelper.GetRSI(barIndex + 1); + bool rsiFlip = (rsiPrev < 30 && rsiNow > rsiPrev); + bool isRSIOk = rsiFlip || kiParser.IsRSIOversold(barIndex); + + // + bool volCooling = kiHelper.GetATR(barIndex) <= kiHelper.GetATRSmoothed(barIndex) * 1.05; + bool isVolatilityOk = volCooling || kiParser.IsVolatilityLow(barIndex); + + // + result = isRSIOk && + isTrendOk && + isVolatilityOk; if (!result) { return result; @@ -1050,7 +1096,6 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector // // Add candlestick confirmation ... XOHCL bar; - ENUM_X_DIRECTION dir; result = result && bar.Init(symbol, period, barIndex); if (!result) @@ -1060,8 +1105,10 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector // result = result && - IsPiercingPattern(bar, dir) && - IsXBearish(dir); + HasCandlestickDirection( + bar, + X_DIRECTION_BULLISH // + ); // bar.Clean(); diff --git a/X121XKIEA/Documents/Analysation.md b/X121XKIEA/Documents/Analysation.md new file mode 100644 index 00000000..503a4627 --- /dev/null +++ b/X121XKIEA/Documents/Analysation.md @@ -0,0 +1,201 @@ +📄 X121XKIEA Framework Pricing & Skill Assessment Document + +Overview + +This document synthesizes the group discussion around the analysis of the X121XKIEA MQL5 Expert Advisor framework, the evaluation of programming skills demonstrated in its design, and the pricing strategy options for monetizing the framework. + +1. Framework Analysis + +High-Level Architecture + +Core Utilities: XCBase, XCommonLib, XModelsLib, XOHCL (bar abstraction). + +Market Structure & Patterns: XCBarAnalyser, XCMarketPatternDetector. + +Visualization: XPOI, XCPOIDrawer, chart object libraries. + +Trading & Risk Management: XCAccount, XCTrade, XCVolume, XCTarget, XCGuard. + +Signalling & Execution: XCBaseSignaller, XCTradeManager. + +Indicators: XKI (Ichimoku/KI composite), XCT (candle timer), XCC (chart cosmetics). + +EA Scaffolding: XCBaseExpert, XCBackTesterEA, X121XKIEABackTester. + +Ancillary: XCAlert, XCDataCollector, XCHttp, XCMD5. + +Strengths + +Modular, layered design. + +Advanced risk management (multi-target, risk-free, guards). + +Rich visualization overlays. + +Event-driven orchestration. + +Issues Identified + +Constructors incorrectly declared with void. + +Unsafe use of ZeroMemory(this) in structs. + +Incomplete/truncated implementations. + +Guard/target concurrency risks. + +Config parsing robustness. + +Recommendations + +Correct constructor/destructor syntax. + +Replace unsafe memory reset patterns. + +Complete truncated modules. + +Add unit-style validations. + +Improve config parsing (JSON-like). + +2. Programming Skill Assessment + +Skill Profile Matrix (Qualitative) + +Architecture: Advanced modular design, clear separation of concerns. + +Syntax & Language: Strong struct/class usage, consistent naming; needs syntactic polish. + +Trading Logic: Sophisticated risk and signal management. + +Visualization: Rich overlays, QA-friendly. + +Maintainability: Event-driven, alerts, config parsing; needs more robust validation. + +Innovation: Pivot regression, multi-strategy signaller design. + +Quantified Scores (1–10) + +Architecture: 9.5 + +Syntax & Language: 7.5 + +Trading Logic: 9.0 + +Visualization: 8.5 + +Maintainability: 8.0 + +Innovation: 9.0 + +Overall Rating: 8.7 / 10 (Advanced/Expert tier) + +3. Pricing Analysis + +Methods Considered + +Cost-Based: $12,000–$15,000 (based on hours × rate). + +Value-Based: $10,000–$50,000 (based on trading edge and impact). + +Market-Based: $1,500–$3,000 (retail EA market), $8,000–$15,000 (institutional/private sale). + +Comparison Table + +Method + +Price Range + +Best Use Case + +Cost-Based + +$12,000–$15,000 + +Consulting, custom builds + +Value-Based + +$10,000–$50,000 + +Exclusive licensing, institutions + +Market-Based + +$1,500–$3,000 (retail)
$8,000–$15,000 (institutional) + +Retail vs private sale + +4. Pricing Strategy Plan + +Retail Market (MQL5 Market) + +Target: Individual traders. + +Price: $1,500–$3,000. + +Pros: Large audience, visibility. + +Cons: Lower margins, copycat risk. + +Best Use: Lite version. + +Institutional Clients + +Target: Prop firms, hedge funds. + +Price: $8,000–$15,000. + +Pros: High margins, prestige. + +Cons: Requires performance proof. + +Best Use: Full framework. + +Licensing Model + +Target: Firms needing ongoing access. + +Price: $2,000–$5,000/year or $500–$1,000/month. + +Pros: Recurring revenue. + +Cons: Requires license enforcement. + +Best Use: Subscription with updates/support. + +Consulting + Custom Builds + +Target: Traders needing tailored solutions. + +Price: $12,000–$15,000/project. + +Pros: Direct monetization of expertise. + +Cons: Time-intensive. + +Best Use: Bespoke strategy builds. + +5. Recommended Strategy + +Dual Approach: + +Retail Lite version (~$2,000). + +Full institutional version (~$10,000–$15,000). + +Add Licensing: For recurring revenue and support. + +Consulting: Premium option for custom builds. + +Future Considerations + +Develop tiered pricing packages (Lite, Pro, Enterprise). + +Provide performance metrics (backtests, live results) to strengthen institutional sales. + +Expand strategy diversity (breakout, continuation, exhaustion signallers). + +End of Document + +https://copilot.microsoft.com/shares/pages/ERAAHojiAwN8eTuiKtiZ2 \ No newline at end of file diff --git a/X121XKIEA/Documents/Analytics.pdf b/X121XKIEA/Documents/Analytics.pdf new file mode 100644 index 00000000..f7909c74 Binary files /dev/null and b/X121XKIEA/Documents/Analytics.pdf differ diff --git a/X121XKIEA/Libraries/.gitkeep b/X121XKIEA/Libraries/.gitkeep new file mode 100644 index 00000000..e69de29b