From 907e1003795b7423429a50c38c29f296d14745ed Mon Sep 17 00:00:00 2001 From: pietro_giacobazzi Date: Sun, 14 Jun 2026 10:24:08 +0200 Subject: [PATCH] Fix: entryTime perso in completedTrades (era 0), LogBarHistory mai chiamata in OnTick, data.Time(0) -> data.time[0], return lotMin -> 0 in CalcRiskLot, entryTime esportato per open trades in CSV --- MQL5/Experts/MultiAgentTest/Core/Orchestrator.mqh | 8 ++++---- MQL5/Experts/MultiAgentTest/MultiAgentTest.mq5 | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/MQL5/Experts/MultiAgentTest/Core/Orchestrator.mqh b/MQL5/Experts/MultiAgentTest/Core/Orchestrator.mqh index 58466fc..877bcae 100644 --- a/MQL5/Experts/MultiAgentTest/Core/Orchestrator.mqh +++ b/MQL5/Experts/MultiAgentTest/Core/Orchestrator.mqh @@ -699,7 +699,7 @@ UpdateHealth(actualReturn); completedTrades[ct].maeATR = openTrades[idx].maeATR; completedTrades[ct].mfeATR = openTrades[idx].mfeATR; completedTrades[ct].actualReturn = actualReturn; - completedTrades[ct].entryTime = 0; + completedTrades[ct].entryTime = openTrades[idx].entryTime; completedTrades[ct].closeTime = TimeCurrent(); completedTrades[ct].exitReason = exitReason; for(int ei = 0; ei < agentCount; ei++) completedTrades[ct].entryZScores[ei] = openTrades[idx].entryZScores[ei]; @@ -1067,8 +1067,8 @@ UpdateHealth(actualReturn); riskPerLot = (tickValue / tickSize) * MathAbs(slPoints); if(riskPerLot <= 0) { - Print(" CalcRiskLot: tickValue=", tickValue, " tickSize=", tickSize, " — impossibile calcolare lotto"); - return lotMin; + Print(" CalcRiskLot: tickValue=", tickValue, " tickSize=", tickSize, " — impossibile calcolare lotto, skip"); + return 0; } double lot = riskAmount / riskPerLot; @@ -1572,7 +1572,7 @@ UpdateHealth(actualReturn); if(!openTrades[i].active) continue; string line = (string)openTrades[i].ticket; line += "," + (string)(openTrades[i].isBuy ? 1 : 0); - line += ",,"; // no close time yet + line += "," + TimeToString(openTrades[i].entryTime) + ","; // entryTime, no close time yet line += "," + (string)openTrades[i].barsHeld; line += "," + StringFormat("%.5f", openTrades[i].entryPrice); line += ","; // no close price yet diff --git a/MQL5/Experts/MultiAgentTest/MultiAgentTest.mq5 b/MQL5/Experts/MultiAgentTest/MultiAgentTest.mq5 index 602e65a..57a5ddf 100644 --- a/MQL5/Experts/MultiAgentTest/MultiAgentTest.mq5 +++ b/MQL5/Experts/MultiAgentTest/MultiAgentTest.mq5 @@ -260,6 +260,7 @@ void OnTick() { if(!data.Fetch()) return; double z = orchestrator.Analyze(data); + orchestrator.LogBarHistory(data.time[0]); FinalSignal fs = orchestrator.GetFinalSignal(Inp_MinZ); double minZ = (Inp_MinZ > 0) ? Inp_MinZ : orchestrator.AdaptiveMinZ();