Page 1 of 1

Logging design for EAs: what to write and when

Posted: Sat Oct 31, 2026 7:02 pm
by Amanhasnoname
A log is only useful if it answers the questions that arise after a failure. Many EAs log too little, or so much that the useful lines are buried.

Think in layers. At the top level, record lifecycle events: start, stop, parameter values, version, account, server. For each signal, record the inputs and the decision: the values of indicators, the spread, why it was accepted or rejected. For each order, record the request, the response code, the time, and the prices. For each position, record updates and the exit reason.

Use consistent formats, with timestamps in a fixed time zone and unique identifiers linking related events. A structured format like CSV or JSON allows later analysis with scripts.

Use log levels, so detailed debugging output can be turned on without flooding normal operation. Keep disk writes light to avoid performance issues.

Rotate files to avoid enormous logs, and back them up.

When something goes wrong at 3 AM, the log is the only witness. It deserves proper design.

What questions should the log be able to answer after a bad trade?