Page 1 of 1

Logging Trades From an EA: What to Record

Posted: Fri Oct 09, 2026 3:25 pm
by FXS Prop Desk
Good logs make it possible to understand what an EA did and why. Many problems only show up in logs.

What to log:
  • Signal time and price, plus indicator values.
  • Order send time and requested price.
  • Fill time and price, slippage.
  • Spread at signal and at fill.
  • Errors and retries.
  • Exit reason.
Format:
  • CSV for analysis.
  • Text logs for debugging.
  • Unique IDs linking signal, order and fill.
Comparing logs from live trading and backtests shows where execution differs.

Log rotation is worth planning too: daily files with a clear naming scheme, kept for a fixed period, make it easier to find a specific day and prevent logs from filling the disk on a small VPS.

What do you log from your EAs?

Re: Logging Trades From an EA: What to Record

Posted: Fri Oct 16, 2026 4:02 pm
by Shadow Trader
The row I added last and now value most is the signal the EA rejected. If it skipped a valid setup for spread or session time, I log the reason code, otherwise the live versus backtest comparison only shows trades that happened.

For the unique ID I build a string from symbol, magic number and the bar open time of the signal. It survives restarts, which a simple counter did not when my VPS rebooted mid session.

Timestamps need two clocks. I write server time plus a local millisecond count from GetTickCount, because server time alone cannot show the 300 to 400 ms gap I sometimes see between send and fill.

On MT5 the retcode gets its own column instead of hiding in free text. Grouping by it after a month showed most of my retries were price changed responses around the London open, not connection drops.

Rotation is easy to underrate. My daily CSV runs 1 to 2 MB on a busy day, so I keep 90 days, but verbose debug text is capped at 14 days.

Do you write to file on every tick, or buffer and flush once per bar? I moved to buffering after the writes started adding visible latency on a cheap VPS.