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
This commit is contained in:
rithsila
2025-09-26 11:17:46 +07:00
parent 60281b5f30
commit ec3f0c49e2
+9 -9
View File
@@ -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)