From eeda9917dcc90fd7783a886f194354e3a9b8fd23 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Mon, 5 May 2025 02:57:28 +0330 Subject: [PATCH] last ... --- Experts/x-saherelm.xcaea.ea.mq5 | 3 + XCAEA/Classes/xcaea.x-poi.detector.class.mq5 | 3 + XCAEA/Signals/xcaea.signaller.class.mq5 | 566 ++++++++++--------- 3 files changed, 292 insertions(+), 280 deletions(-) diff --git a/Experts/x-saherelm.xcaea.ea.mq5 b/Experts/x-saherelm.xcaea.ea.mq5 index 43c6331d..2dbcfcd4 100644 --- a/Experts/x-saherelm.xcaea.ea.mq5 +++ b/Experts/x-saherelm.xcaea.ea.mq5 @@ -141,6 +141,9 @@ void OnDeinit(const int reason) // REASON_INITFAILED 8 The OnInit() handler returned a non-zero value // REASON_CLOSE 9 Terminal closed + // + eaSignaller.DeInit(); + // ZeroMemory(eaAlert); ZeroMemory(eaTrade); diff --git a/XCAEA/Classes/xcaea.x-poi.detector.class.mq5 b/XCAEA/Classes/xcaea.x-poi.detector.class.mq5 index 124a1641..58f44112 100644 --- a/XCAEA/Classes/xcaea.x-poi.detector.class.mq5 +++ b/XCAEA/Classes/xcaea.x-poi.detector.class.mq5 @@ -817,9 +817,11 @@ class XCXCAEAPOIDetector : public XCBase detectValePivots = false; // + maxAllowedPVLifetime = 0; applySwingsOnPVPivots = false; selectRejectedPVPivots = false; selectEngulfedPVPivots = false; + selectPVWhichStartByFVG = false; applySupportAndResistanceOnPVPivots = false; // @@ -1215,6 +1217,7 @@ class XCXCAEAPOIDetector : public XCBase bool applySwingsOnPVPivots; // Apply Swings on PV Pivots ... bool selectRejectedPVPivots; // Select Rejected PV Pivots ... bool selectEngulfedPVPivots; // Select Engulfed PV Pivots ... + bool selectPVWhichStartByFVG; // Select PV Pivots Which Starts by FVG ... bool applySupportAndResistanceOnPVPivots; // Apply Support and Resistance on PV Pivots ... // diff --git a/XCAEA/Signals/xcaea.signaller.class.mq5 b/XCAEA/Signals/xcaea.signaller.class.mq5 index b90d5886..b607e80a 100644 --- a/XCAEA/Signals/xcaea.signaller.class.mq5 +++ b/XCAEA/Signals/xcaea.signaller.class.mq5 @@ -78,11 +78,297 @@ class XCXCAEASignaller : XCBase // // Properties ... + /** + * Initialize ... + */ + void Init() + { + // + useGuards = false; + useTargets = true; + rfOnInvalidPivots = false; + continuesRFTillTarget = false; + + // + barTraker.Init( + symbol, + period // + ); + + // + inputs.Default(); + + // + // Configure Indicators ... + + // + // XCC ... + inputs.ccInputs.showCandles = true; + + // + // XCT ... + inputs.ctInputs.showCandleTime = true; + + // + // XCA ... + + // + inputs.caInputs.supResSmoothingLength = 7; + inputs.caInputs.supResSmoothingMode = X_MA_MODE_NONE; + + // + inputs.x3maInputs.applyColor = true; + + // + inputs.x3maInputs.fastLength = 5; + + // + inputs.x3maInputs.showFast = false; + inputs.x3maInputs.showSlow = false; + inputs.x3maInputs.showMedium = false; + + // + inputs.caInputs.showKI = false; + inputs.caInputs.showTKI = false; + inputs.caInputs.showSar = false; + inputs.caInputs.showMAH = true; + inputs.caInputs.showMAL = false; + inputs.caInputs.showMAC = true; + inputs.caInputs.showVidya = false; + inputs.caInputs.showTrend = true; + inputs.caInputs.showSwings = false; + inputs.caInputs.showLongCycle = false; + inputs.caInputs.showHindCycle = false; + inputs.caInputs.showFiboLevel1 = false; + inputs.caInputs.showFiboLevel2 = false; + inputs.caInputs.showFiboLevel3 = false; + inputs.caInputs.showShortCycle = false; + inputs.caInputs.showMediumCycle = false; + inputs.caInputs.showPeaksAndVales = true; + inputs.caInputs.showPeakAndValeGolden = false; + inputs.caInputs.showSupportAndResistance = false; + + // + // XOSCS ... + // inputs.oscsInputs.rsiLength = 5; + // inputs.oscsInputs.rsiOBLevel = 90; + // inputs.oscsInputs.rsiOSLevel = 10; + // inputs.oscsInputs.cciLength = 7; + // inputs.oscsInputs.cciOBLevel = 130; + // inputs.oscsInputs.cciOSLevel = -130; + // inputs.oscsInputs.mfiLength = 5; + // inputs.oscsInputs.rviLength = 5; + + // + // Oscillators Views ... + inputs.showRSI = false; + inputs.showCCI = false; + inputs.showMFI = false; + inputs.showRVI = false; + inputs.showADX = false; + inputs.showMACD = false; + + // + // XCAEA Helper ... + helper = new XCXCAEAHelper(); + helper.Init( + symbol, + period, + inputs // + ); + + // + // Initialize and Configure Detector ... + detector = new XCXCAEAPOIDetector(helper); + + // + // Common Configurations ... + detector.maxAllowedPivots = 0; + detector.pivotVerifications = 5; + detector.ticksDividerInPoints = 15; + detector.pivotDetectionLoopbac = 1000; + + // + // Configure Detector ... + + // + // PV ... + + // + detector.maxAllowedPVLifetime = 0; + detector.applySwingsOnPVPivots = true; + detector.selectRejectedPVPivots = true; + detector.selectEngulfedPVPivots = true; + detector.applySupportAndResistanceOnPVPivots = true; + + // + // PEAK ... + detector.detectPeakPivots = true; + + // + // VALE ... + detector.detectValePivots = true; + + // + // FVG ... + + // + detector.selectSameBarFVGs = false; + detector.maxAllowedFVGLifetime = 0; + detector.validateFVGUsingPV = false; + detector.applyPVToFVGBoundary = false; + detector.selectRejectedFVGPivots = false; + detector.selectEngulfedFVGPivots = false; + detector.validateFVGUsingManalyser = true; + detector.applyLastBarToFVGBoundary = false; + detector.selectOnlyFVGWhichHasIndirectionalLastBar = true; + + // + // Bullish ... + detector.detectFVGBullishPivots = true; + + // + // Bearish ... + detector.detectFVGBearishPivots = true; + + // + // TREND ... + + // + detector.maxAllowedTrendLifetime = 0; + + // + // Bullish ... + detector.detectTrendBullishPivots = true; + + // + // Bearish ... + detector.detectTrendBearishPivots = true; + + // + // DRAWER ... + + // + // Initialize and Configure Drawer ... + drawer = new XCXCAEAPOIDrawer(detector); + + // + drawer.ignoreUpdateOSCTos = true; + + // + // Configure Drawer ... + drawer.drawPeakPivots = true; + drawer.drawValePivots = true; + drawer.drawFVGBullishPivots = true; + drawer.drawFVGBearishPivots = true; + drawer.drawTrendBullishPivots = true; + drawer.drawTrendBearishPivots = true; + + // + // Configure Styles ... + + // + // PV ... + + // + // PEAK ... + XCAPivotStyle peakStyle; + peakStyle.width = 2; + peakStyle.clr = clrMagenta; + peakStyle.style = STYLE_SOLID; + drawer.peakPivotStyle = peakStyle; + peakStyle.Clean(); + + // + // VALE ... + XCAPivotStyle valeStyle; + valeStyle.width = 2; + valeStyle.clr = clrAqua; + valeStyle.style = STYLE_SOLID; + drawer.valePivotStyle = valeStyle; + valeStyle.Clean(); + + // + // FVG ... + + // + // Bullish ... + XCAPivotStyle fvgBullishStyle; + fvgBullishStyle.width = 2; + fvgBullishStyle.clr = clrLime; + fvgBullishStyle.style = STYLE_DASH; + drawer.fvgBullishPivotStyle = fvgBullishStyle; + fvgBullishStyle.Clean(); + + // + // Bearish ... + XCAPivotStyle fvgBearishStyle; + fvgBearishStyle.width = 2; + fvgBearishStyle.clr = clrRed; + fvgBearishStyle.style = STYLE_DASH; + drawer.fvgBearishPivotStyle = fvgBearishStyle; + fvgBearishStyle.Clean(); + + // + // TREND ... + + // + // Bullish ... + XCAPivotStyle trendBullishStyle; + trendBullishStyle.width = 2; + trendBullishStyle.clr = clrLime; + trendBullishStyle.style = STYLE_DOT; + drawer.trendBullishPivotStyle = trendBullishStyle; + trendBullishStyle.Clean(); + + // + // Bearish ... + XCAPivotStyle trendBearishStyle; + trendBearishStyle.width = 2; + trendBearishStyle.clr = clrRed; + trendBearishStyle.style = STYLE_DOT; + drawer.trendBearishPivotStyle = trendBearishStyle; + trendBearishStyle.Clean(); + + // + } + + /** + * DeInitialize ... + */ + void DeInit() + { + // + inputs.Clean(); + + // + // Cleaning Draws ... + drawer.Clear(); + + // + ZeroMemory(drawer); + ZeroMemory(helper); + ZeroMemory(detector); + + // + mConditions.Clean(); + Clean(mConditionsCollection); + + // + mObjects.Clear(); + mBarObjects.Clear(); + + // + barTraker.Clean(); + } + + // string GetSymbol() { return symbol; } + // ENUM_TIMEFRAMES GetPeriod() { return period; @@ -767,286 +1053,6 @@ class XCXCAEASignaller : XCBase CArrayObj mObjects; CArrayObj mBarObjects; - /** - * Initialize ... - */ - void Init() - { - // - useGuards = false; - useTargets = true; - rfOnInvalidPivots = false; - continuesRFTillTarget = false; - - // - barTraker.Init( - symbol, - period // - ); - - // - inputs.Default(); - - // - // Configure Indicators ... - - // - // XCC ... - inputs.ccInputs.showCandles = true; - - // - // XCT ... - inputs.ctInputs.showCandleTime = true; - - // - // XCA ... - - // - inputs.caInputs.supResSmoothingLength = 7; - inputs.caInputs.supResSmoothingMode = X_MA_MODE_NONE; - - // - inputs.x3maInputs.applyColor = true; - - // - inputs.x3maInputs.fastLength = 5; - - // - inputs.x3maInputs.showFast = false; - inputs.x3maInputs.showSlow = false; - inputs.x3maInputs.showMedium = false; - - // - inputs.caInputs.showKI = false; - inputs.caInputs.showTKI = false; - inputs.caInputs.showSar = false; - inputs.caInputs.showMAH = true; - inputs.caInputs.showMAL = false; - inputs.caInputs.showMAC = true; - inputs.caInputs.showVidya = false; - inputs.caInputs.showTrend = true; - inputs.caInputs.showSwings = false; - inputs.caInputs.showLongCycle = false; - inputs.caInputs.showHindCycle = false; - inputs.caInputs.showFiboLevel1 = false; - inputs.caInputs.showFiboLevel2 = false; - inputs.caInputs.showFiboLevel3 = false; - inputs.caInputs.showShortCycle = false; - inputs.caInputs.showMediumCycle = false; - inputs.caInputs.showPeaksAndVales = true; - inputs.caInputs.showPeakAndValeGolden = false; - inputs.caInputs.showSupportAndResistance = false; - - // - // XOSCS ... - // inputs.oscsInputs.rsiLength = 5; - // inputs.oscsInputs.rsiOBLevel = 90; - // inputs.oscsInputs.rsiOSLevel = 10; - // inputs.oscsInputs.cciLength = 7; - // inputs.oscsInputs.cciOBLevel = 130; - // inputs.oscsInputs.cciOSLevel = -130; - // inputs.oscsInputs.mfiLength = 5; - // inputs.oscsInputs.rviLength = 5; - - // - // Oscillators Views ... - inputs.showRSI = false; - inputs.showCCI = false; - inputs.showMFI = false; - inputs.showRVI = false; - inputs.showADX = false; - inputs.showMACD = false; - - // - // XCAEA Helper ... - helper = new XCXCAEAHelper(); - helper.Init( - symbol, - period, - inputs // - ); - - // - // Initialize and Configure Detector ... - detector = new XCXCAEAPOIDetector(helper); - - // - // Common Configurations ... - detector.maxAllowedPivots = 0; - detector.pivotVerifications = 5; - detector.ticksDividerInPoints = 15; - detector.pivotDetectionLoopbac = 200; - - // - // Configure Detector ... - - // - // PV ... - - // - detector.maxAllowedPVLifetime = 0; - detector.applySwingsOnPVPivots = true; - detector.selectRejectedPVPivots = true; - detector.selectEngulfedPVPivots = true; - detector.applySupportAndResistanceOnPVPivots = true; - - // - // PEAK ... - detector.detectPeakPivots = true; - - // - // VALE ... - detector.detectValePivots = true; - - // - // FVG ... - - // - detector.selectSameBarFVGs = false; - detector.maxAllowedFVGLifetime = 0; - detector.validateFVGUsingPV = false; - detector.applyPVToFVGBoundary = false; - detector.selectRejectedFVGPivots = false; - detector.selectEngulfedFVGPivots = false; - detector.validateFVGUsingManalyser = true; - detector.applyLastBarToFVGBoundary = false; - detector.selectOnlyFVGWhichHasIndirectionalLastBar = true; - - // - // Bullish ... - detector.detectFVGBullishPivots = true; - - // - // Bearish ... - detector.detectFVGBearishPivots = true; - - // - // TREND ... - - // - detector.maxAllowedTrendLifetime = 0; - - // - // Bullish ... - detector.detectTrendBullishPivots = true; - - // - // Bearish ... - detector.detectTrendBearishPivots = true; - - // - // DRAWER ... - - // - // Initialize and Configure Drawer ... - drawer = new XCXCAEAPOIDrawer(detector); - - // - drawer.ignoreUpdateOSCTos = true; - - // - // Configure Drawer ... - drawer.drawPeakPivots = true; - drawer.drawValePivots = true; - drawer.drawFVGBullishPivots = true; - drawer.drawFVGBearishPivots = true; - drawer.drawTrendBullishPivots = true; - drawer.drawTrendBearishPivots = true; - - // - // Configure Styles ... - - // - // PV ... - - // - // PEAK ... - XCAPivotStyle peakStyle; - peakStyle.width = 2; - peakStyle.clr = clrMagenta; - peakStyle.style = STYLE_SOLID; - drawer.peakPivotStyle = peakStyle; - peakStyle.Clean(); - - // - // VALE ... - XCAPivotStyle valeStyle; - valeStyle.width = 2; - valeStyle.clr = clrAqua; - valeStyle.style = STYLE_SOLID; - drawer.valePivotStyle = valeStyle; - valeStyle.Clean(); - - // - // FVG ... - - // - // Bullish ... - XCAPivotStyle fvgBullishStyle; - fvgBullishStyle.width = 2; - fvgBullishStyle.clr = clrLime; - fvgBullishStyle.style = STYLE_DASH; - drawer.fvgBullishPivotStyle = fvgBullishStyle; - fvgBullishStyle.Clean(); - - // - // Bearish ... - XCAPivotStyle fvgBearishStyle; - fvgBearishStyle.width = 2; - fvgBearishStyle.clr = clrRed; - fvgBearishStyle.style = STYLE_DASH; - drawer.fvgBearishPivotStyle = fvgBearishStyle; - fvgBearishStyle.Clean(); - - // - // TREND ... - - // - // Bullish ... - XCAPivotStyle trendBullishStyle; - trendBullishStyle.width = 2; - trendBullishStyle.clr = clrLime; - trendBullishStyle.style = STYLE_DOT; - drawer.trendBullishPivotStyle = trendBullishStyle; - trendBullishStyle.Clean(); - - // - // Bearish ... - XCAPivotStyle trendBearishStyle; - trendBearishStyle.width = 2; - trendBearishStyle.clr = clrRed; - trendBearishStyle.style = STYLE_DOT; - drawer.trendBearishPivotStyle = trendBearishStyle; - trendBearishStyle.Clean(); - - // - } - - /** - * DeInitialize ... - */ - void DeInit() - { - // - inputs.Clean(); - - // - ZeroMemory(drawer); - ZeroMemory(helper); - ZeroMemory(detector); - - // - mConditions.Clean(); - Clean(mConditionsCollection); - - // - mObjects.Clear(); - mBarObjects.Clear(); - - // - barTraker.Clean(); - } - // };