Logging in an EA: what to write so a bad trade can be explained later
Posted: Tue Nov 03, 2026 8:39 am
Most EAs log too little. When a live trade goes wrong, the question "why did it do that?" often has no answer. A logging plan fixes that.
What to log at each decision:
Size isn't usually a problem; a busy day's log is a few megabytes at most. Delete or archive old files monthly.
A useful extra: log skipped signals with the reason. "Signal skipped: spread 1.4 > 1.0" explains a missing trade that someone will ask about later.
When a live trade looks wrong, the log should let you replay the decision without guessing.
What do you log in your EAs?
What to log at each decision:
- Time in server time and in UTC, to avoid confusion with time zones.
- Bid, ask and spread at the moment of the decision.
- The values of every input the rule used, for example indicator values or the level being tested.
- The decision: entry, skip, modify, close, and the reason in a short code.
- Order send result: return code, ticket, fill price and the requested price.
Size isn't usually a problem; a busy day's log is a few megabytes at most. Delete or archive old files monthly.
A useful extra: log skipped signals with the reason. "Signal skipped: spread 1.4 > 1.0" explains a missing trade that someone will ask about later.
When a live trade looks wrong, the log should let you replay the decision without guessing.
What do you log in your EAs?