From 383d58eaed5c61193aa423782466d710cff6b333 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Mon, 22 Sep 2025 21:20:27 +0330 Subject: [PATCH] last works ... --- Libraries/x-saherelm.x-pivot.analysis.lib.mq5 | 118 +++++++++++++++++- 1 file changed, 113 insertions(+), 5 deletions(-) diff --git a/Libraries/x-saherelm.x-pivot.analysis.lib.mq5 b/Libraries/x-saherelm.x-pivot.analysis.lib.mq5 index 1c8ff0ae..7b173c00 100644 --- a/Libraries/x-saherelm.x-pivot.analysis.lib.mq5 +++ b/Libraries/x-saherelm.x-pivot.analysis.lib.mq5 @@ -32,6 +32,7 @@ struct XPivotAnalysis { // // Props ... + string name; // Name ... string symbol; // Symbol ... datetime time; // Time ... XPivot pivots[]; // Pivots ... @@ -92,6 +93,7 @@ struct XPivotAnalysis { // time = NULL; + name = NULL; symbol = NULL; period = NULL; SpecifiedClean(pivots); @@ -143,6 +145,7 @@ struct XPivotAnalysis /** * Initialize Model ... * + * @param _name: Name ... * @param _symbol: Symbol ... * @param _period: Period ... * @param _pivots: Provided Pivots ... @@ -150,6 +153,7 @@ struct XPivotAnalysis * @return ( bool ) */ bool Init( + string _name, string _symbol, ENUM_TIMEFRAMES _period, XPivot &_pivots[] // @@ -162,6 +166,7 @@ struct XPivotAnalysis // Validate Args ... result = HasChild(_pivots) && + IsSpecifiedValid(_name) && IsSpecifiedValid(_symbol) && IsSpecifiedValid(_period); if (!result) @@ -172,6 +177,7 @@ struct XPivotAnalysis } // + name = _name; symbol = _symbol; period = _period; Copy( @@ -913,6 +919,107 @@ struct XPivotAnalysis ); } + // + // Boxing Tools ... + + /** + * Generate Support Box if Has Strong Supports ... + * + * @param box: a refrence XBoxZone to holds Generated result ... + * + * @return ( bool ) + */ + bool HasSupportBox(XBoxZone &box) + { + // + bool result = false; + + // + // Prepare ... + box.Clean(); + + // + // Validate ... + result = + IsValid() && + IsAnalysed(); + if (!result) + { + return result; + } + + // + box.to = toTime; + box.symbol = symbol; + box.period = period; + box.from = fromTime; + + // + box.upper = minorSupport; + box.lower = majorSupport; + box.dir = X_DIRECTION_BULLISH; + box.type = GetTag() + "_Support"; + + // + result = box.IsValid(); + if (!result) + { + box.Clean(); + } + + // + return result; + } + + /** + * Generate Resistance Box if Has Strong Resistance ... + * + * @param box: a refrence XBoxZone to holds Generated result ... + * + * @return ( bool ) + */ + bool HasResistanceBox(XBoxZone &box) + { + // + bool result = false; + + // + // Prepare ... + box.Clean(); + + // + // Validate ... + result = + IsValid() && + IsAnalysed(); + if (!result) + { + return result; + } + + // + box.to = toTime; + box.symbol = symbol; + box.period = period; + box.from = fromTime; + + // + box.upper = minorResistance; + box.lower = majorResistance; + box.dir = X_DIRECTION_BEARISH; + box.type = GetTag() + "_Resistance"; + + // + result = box.IsValid(); + if (!result) + { + box.Clean(); + } + + // + return result; + } + // // Detecting ... @@ -923,7 +1030,7 @@ struct XPivotAnalysis * * @return ( bool ) */ - bool IsSameAs(XPivot &item) + bool IsSameAs(XPivotAnalysis &item) { // bool result = false; @@ -932,6 +1039,7 @@ struct XPivotAnalysis result = IsValid() && item.IsValid() && IsSameMarketAs(item) && + name == item.name && time == item.time; // @@ -945,7 +1053,7 @@ struct XPivotAnalysis * * @return ( bool ) */ - bool IsSameSymbolAs(XPivot &item) + bool IsSameSymbolAs(XPivotAnalysis &item) { // bool result = false; @@ -966,7 +1074,7 @@ struct XPivotAnalysis * * @return ( bool ) */ - bool IsSamePeriodAs(XPivot &item) + bool IsSamePeriodAs(XPivotAnalysis &item) { // bool result = false; @@ -987,7 +1095,7 @@ struct XPivotAnalysis * * @return ( bool ) */ - bool IsSameMarketAs(XPivot &item) + bool IsSameMarketAs(XPivotAnalysis &item) { // bool result = false; @@ -1012,7 +1120,7 @@ struct XPivotAnalysis */ string GetTag() { - return GetToken(this); + return name + GetToken(this); } /**