Page 1 of 1

Logging in an EA: what to write so a bad trade can be explained later

Posted: Tue Nov 03, 2026 8:39 am
by FXS London Scalper
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:
  • 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.
Format: one line per event, comma-separated, written to a file per day. That makes it easy to open in a spreadsheet or parse with a script.

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?

Re: Logging in an EA: what to write so a bad trade can be explained later

Posted: Thu Nov 05, 2026 5:19 am
by Amanhasnoname
The most useful thing I added to my own EA logs was a short reason code on every skipped signal. Mine looks like SKIP_SPREAD or SKIP_NEWS_WINDOW or SKIP_MAXPOS, followed by the actual values. A few weeks later when a friend asked why the bot missed a perfect looking move, I found the answer in ten seconds instead of guessing.

Another one that saved me was logging the requested price next to the fill price on every order, plus the retcode. I noticed one broker returning requotes only on stop orders sent within a few seconds of the hour, which I would never have seen in the platform journal. It turned out to be a rollover quirk and I changed my order type.

I keep one file per day, with a header line at the top containing the EA version and the main inputs. When I change the settings, the log shows me exactly which version was running that day. Without that, comparing two weeks of results becomes a guessing game.