diff --git a/Libraries/x-saherelm.common.lib.mq5 b/Libraries/x-saherelm.common.lib.mq5 index ed1c736f..9028b635 100644 --- a/Libraries/x-saherelm.common.lib.mq5 +++ b/Libraries/x-saherelm.common.lib.mq5 @@ -5695,7 +5695,8 @@ struct XMarketParser string _version; // Temp ... // - bool IsIngot(string market) { + bool IsIngot(string market) + { // bool result = false; @@ -5708,7 +5709,8 @@ struct XMarketParser } // - bool IsErrante(string market) { + bool IsErrante(string market) + { // bool result = false; @@ -5721,7 +5723,8 @@ struct XMarketParser } // - bool IsAMarkets(string market) { + bool IsAMarkets(string market) + { // bool result = false; @@ -5734,7 +5737,8 @@ struct XMarketParser } // - bool IsIFCMarkets(string market) { + bool IsIFCMarkets(string market) + { // bool result = false; @@ -5747,7 +5751,8 @@ struct XMarketParser } // - bool IsOtetMarkets(string market) { + bool IsOtetMarkets(string market) + { // bool result = false; @@ -5757,9 +5762,9 @@ struct XMarketParser // return result; - } + } - // + // }; // @@ -9876,6 +9881,80 @@ bool Contains( return result; } +// +int FindIndexes( + string mQuery, // Search String + string mContent, // Search Content + int &result[], // Holding Results + bool ignoreCase = false // Ignore Case +) +{ + // + int mResult = 0; + + // + Clean(result); + + // + // Validate Inputs ... + if (!IsValid(mQuery) || + !IsValid(mContent)) + { + return mResult; + } + + // + // Apply Ignore Case if Provided ... + if (ignoreCase) + { + // + bool isConverted = StringToLower(mQuery); + if (!isConverted) + { + return mResult; + } + + // + isConverted = StringToLower(mContent); + if (!isConverted) + { + return mResult; + } + } + + // + // Search First Index ... + int lastPos = 0; + int idx = StringFind( + mContent, + mQuery, + lastPos // + ); + while (idx >= 0) + { + // + // Add Position to Result ... + Add( + idx, + result // + ); + + // + lastPos = idx + StringLen(mQuery); + idx = StringFind( + mContent, + mQuery, + lastPos // + ); + } + + // + mResult = ArraySize(result); + + // + return mResult; +} + // // Convert From String ... template diff --git a/Parsers/x-saherelm.xch.parser.mq5 b/Parsers/x-saherelm.xch.parser.mq5 index f7e2105d..4bbdc399 100644 --- a/Parsers/x-saherelm.xch.parser.mq5 +++ b/Parsers/x-saherelm.xch.parser.mq5 @@ -756,6 +756,33 @@ struct XCHStartegyConditionsParser "||" + "\n" + "//"; + // + string query = "&&"; + int andIndexes[]; + int andIndexesCount = FindIndexes( + query, + result, + andIndexes // + ); + if (IsValidSize(andIndexesCount)) { + // + int lastAndIndex = andIndexes[ArraySize(andIndexes) - 1]; + + // + string beforeStr = StringSubstr( + result, + 0, + lastAndIndex // + ); + string afterStr = StringSubstr( + result, + lastAndIndex + StringLen(query) + ); + + // + result = beforeStr + afterStr; + } + // return result; }