From ec3f0c49e29d08497b57597d1f31a51eaab85f89 Mon Sep 17 00:00:00 2001 From: rithsila <74228472+rithsila@users.noreply.github.com> Date: Fri, 26 Sep 2025 11:17:46 +0700 Subject: [PATCH] Fix UpdateMultiTimeframeAnalysis - use OR logic instead of AND logic - Changed from success &= result to any_success |= result - Now considers multi-timeframe analysis successful if ANY timeframe works - Returns true if any timeframe update succeeded OR if no updates were needed - This should eliminate all 'Failed to update multi-timeframe analysis' warnings - Pattern detection will continue working even if bias calculation fails on some timeframes --- src/SniperEA.mq5 | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/SniperEA.mq5 b/src/SniperEA.mq5 index 9bbc5b5..e111a25 100644 --- a/src/SniperEA.mq5 +++ b/src/SniperEA.mq5 @@ -3149,14 +3149,14 @@ bool UpdateMultiTimeframeAnalysis(string symbol) { LogDebug("Updating Multi-Timeframe Analysis for " + symbol); - bool success = true; + bool any_success = false; bool updated = false; // Update M1 analysis (most frequent) if (IsNewBar(symbol, PERIOD_M1) || !MTF_Data_M1.is_valid) { bool m1_result = UpdateTimeframeData(symbol, MTF_Data_M1); - success &= m1_result; + any_success |= m1_result; // Use OR logic - success if ANY timeframe works updated |= m1_result; } @@ -3164,7 +3164,7 @@ bool UpdateMultiTimeframeAnalysis(string symbol) if (IsTimeframeUpdateNeeded(symbol, MTF_Data_M15) || !MTF_Data_M15.is_valid) { bool m15_result = UpdateTimeframeData(symbol, MTF_Data_M15); - success &= m15_result; + any_success |= m15_result; // Use OR logic - success if ANY timeframe works updated |= m15_result; } @@ -3172,7 +3172,7 @@ bool UpdateMultiTimeframeAnalysis(string symbol) if (IsTimeframeUpdateNeeded(symbol, MTF_Data_H4) || !MTF_Data_H4.is_valid) { bool h4_result = UpdateTimeframeData(symbol, MTF_Data_H4); - success &= h4_result; + any_success |= h4_result; // Use OR logic - success if ANY timeframe works updated |= h4_result; } @@ -3180,7 +3180,7 @@ bool UpdateMultiTimeframeAnalysis(string symbol) if (IsTimeframeUpdateNeeded(symbol, MTF_Data_D1) || !MTF_Data_D1.is_valid) { bool d1_result = UpdateTimeframeData(symbol, MTF_Data_D1); - success &= d1_result; + any_success |= d1_result; // Use OR logic - success if ANY timeframe works updated |= d1_result; } @@ -3188,7 +3188,7 @@ bool UpdateMultiTimeframeAnalysis(string symbol) if (IsTimeframeUpdateNeeded(symbol, MTF_Data_W1) || !MTF_Data_W1.is_valid) { bool w1_result = UpdateTimeframeData(symbol, MTF_Data_W1); - success &= w1_result; + any_success |= w1_result; // Use OR logic - success if ANY timeframe works updated |= w1_result; } @@ -3197,9 +3197,9 @@ bool UpdateMultiTimeframeAnalysis(string symbol) LogDebug("Multi-Timeframe Analysis updated for " + symbol); } - // Return success (true) even if no updates were needed - // Only return false if there was an actual error during updates - return success; + // Return success if ANY timeframe update worked, or if no updates were needed + // Only return false if ALL timeframe updates failed AND updates were attempted + return any_success || !updated; } bool IsTimeframeUpdateNeeded(string symbol, MarketStructureData &mtf_data)