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

This commit is contained in:
pietro_giacobazzi
2026-06-14 10:24:08 +02:00
parent e7d38ec937
commit 907e100379
2 changed files with 5 additions and 4 deletions
@@ -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
@@ -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();