From 99f0e57d2e6aa1c31e18cc2fb18d5ac01d14dacc Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Fri, 23 May 2025 17:25:59 +0330 Subject: [PATCH] last ... --- Indicators/x-saherelm.x121.xcatb.mq5 | 32 +++++++++++++++++- Libraries/x-saherelm.x121.xcatb.lib.mq5 | 45 +++++++++++++++++++++---- 2 files changed, 70 insertions(+), 7 deletions(-) diff --git a/Indicators/x-saherelm.x121.xcatb.mq5 b/Indicators/x-saherelm.x121.xcatb.mq5 index 6fec306d..d0ea0481 100644 --- a/Indicators/x-saherelm.x121.xcatb.mq5 +++ b/Indicators/x-saherelm.x121.xcatb.mq5 @@ -84,6 +84,7 @@ input ENUM_X_MARKET_CYCLES appliedCycle = X_MARKET_CYCLE_HIND; // Applied Cycle // Signal ... input group "Signal"; input int signalR2R = 4; // Risk Reward Ratio +input bool drawSignals = true; // Draw Signal input double slAtrMultiplier = 1.0; // ATR Multiplier for SL // @@ -2023,11 +2024,40 @@ void CalculateValues( has = DrawTriggerBlock( tb, mDrawer, - mObjects // + mObjects, + NULL, + drawSignals // ); // // Alert ... + bool canAlert = + mEnableAlerts && + prevCalculated > 0; + bool canLogOnly = + mEnableAlerts && + prevCalculated == 0; + if (has && + (canAlert || + canLogOnly)) + { + // + string message = + tb.trigger.symbol + "," + + ToString(tb.trigger.period) + "> " + + ToString(tb.trigger.dir) + + " Zone Detected at: " + ToString(tb.trigger.to); + + // + if (canLogOnly) + { + mAlert.LogAlert(message); + } + else if (canAlert) + { + mAlert.Alert(message); + } + } } } diff --git a/Libraries/x-saherelm.x121.xcatb.lib.mq5 b/Libraries/x-saherelm.x121.xcatb.lib.mq5 index 4f967b0d..0e69c47d 100644 --- a/Libraries/x-saherelm.x121.xcatb.lib.mq5 +++ b/Libraries/x-saherelm.x121.xcatb.lib.mq5 @@ -184,6 +184,27 @@ struct XTriggerBlock // }; +// +XTriggerBlock mX121TriggerBlocks[]; + +// +int HasX121TriggerBlocks() +{ + return HasChild(mX121TriggerBlocks); +} + +// +int CountX121TriggerBlocks() +{ + return ArraySize(mX121TriggerBlocks); +} + +// +void CleanX121TriggerBlocks() +{ + Clean(mX121TriggerBlocks) l +} + // // Extensions ... @@ -260,6 +281,10 @@ bool DetectTriggerBlock( // // Custom Configs ... + // + _r2r = 2; + _slAtrMultiplier = 1; + // // Validators ... _forceHasSwing = true; @@ -270,7 +295,7 @@ bool DetectTriggerBlock( // _forceHasFLiquidity = false; _forceHasRLiquidity = false; - _validateBlockEdgeBreakout = false; + _validateBlockEdgeBreakout = true; // // Filters ... @@ -280,12 +305,12 @@ bool DetectTriggerBlock( _filterBasedOnVolume = true; // - _filterBasedOnSar = false; + _filterBasedOnSar = true; _filterBasedOnRSI = false; _filterBasedOnADX = false; _filterBasedOnTrend = false; - _filterBasedOnSignalBar = false; - _filterBasedOnHKSignalBar = false; + _filterBasedOnSignalBar = true; + _filterBasedOnHKSignalBar = true; // tb.Clean(); @@ -1062,6 +1087,12 @@ bool DetectTriggerBlock( targets, slAdditional // ); + + // + Add( + tb, + mX121TriggerBlocks // + ); } // @@ -1078,8 +1109,9 @@ bool DrawTriggerBlock( XCPOIDrawer *drawer, CArrayObj &objects, datetime to = NULL, - int rrZoneLength = 10, // + bool _drawSignals = false, + int rrZoneLength = 10, // Styles ... // // Trigger Block ... @@ -1331,7 +1363,8 @@ bool DrawTriggerBlock( // // Draw RR of Signal ... - if (trigger.signal.IsValid() && + if (_drawSignals && + trigger.signal.IsValid() && rrZoneLength > 0) { //