Saving indicator values at entry so you can analyse trades later
When an EA opens a trade, it usually logs the time, price, size and maybe the reason. What it often doesn't log is the state of the market at that moment: the indicator values, the spread, the ATR, the distance to the nearest level.
Saving those values with each trade makes later analysis much easier. You can look at whether trades with a higher ATR at entry did better or worse, whether the RSI value at entry made a difference, or whether trades entered with a wider spread performed worse.
Without that data, you'd have to recalculate it from historical prices, which is possible but tedious, and the values might differ slightly from what the EA saw live.
What I'd log: the values of every indicator the strategy uses, plus a few that it doesn't use but might be interesting, like ATR on a couple of timeframes, the spread, the time since the session opened, and the distance from the daily open. All written to a CSV row with the trade ID.
Then, after a few hundred trades, you can load the file into a spreadsheet or Python and look for patterns. This is how a lot of useful filters get discovered, from data rather than guesses.
The cost is a few lines of code and a slightly bigger log file.
Saving indicator values at entry so you can analyse trades later
Re: Saving indicator values at entry so you can analyse trades later
It's important to log the values that the EA actually used for the decision, not values recalculated a moment later. If the indicator is read on the current forming bar, the value at the moment of entry might differ from the final value of that bar. Logging the exact value used avoids confusion when comparing with charts later. For indicators read on the last closed bar, it's less of an issue, but logging which bar was used helps too. Writing the bar index or the bar time next to each value makes it easy to match the log with the chart later.
It’s Fairman 
Re: Saving indicator values at entry so you can analyse trades later
Be careful with drawing conclusions from many indicators at once. If you log twenty values and look for any that correlate with good trades, some will by chance. Splitting the data into two halves, finding a pattern in the first, and checking it in the second helps avoid that. A filter that only works in the half where you found it is probably noise. Logging lots of data is good. Testing patterns honestly before adding them to the strategy is what makes the data useful. A holdout period kept aside until the very end is a simple way to keep yourself honest about it. If the filter still helps there, it has a much better chance live.
It’s Fairman 
-
FXS Prop Desk
- Posts: 1572
- Joined: Wed Oct 07, 2026 9:52 am
Re: Saving indicator values at entry so you can analyse trades later
Logging the market state at entry turns the trade history into a dataset. Months later, you can ask questions like "do trades with ATR above X perform better?" without rerunning any backtest.
Writing it to a CSV with one row per trade, and a column for each value, is usually enough. It helps to include the spread and the time since the session opened, since those two often explain more of the results than indicator values.
Writing it to a CSV with one row per trade, and a column for each value, is usually enough. It helps to include the spread and the time since the session opened, since those two often explain more of the results than indicator values.
FXS Official Team | The Idea Lab & Strategy
Re: Saving indicator values at entry so you can analyse trades later
Logging values at exit as well as entry gives a fuller picture. If the RSI was 70 at entry and 45 at exit, that tells you something about how the trade developed. Comparing exit values on winners and losers might show patterns, like losers tending to exit when ATR had jumped. It doubles the logging but adds a lot to the analysis. In an EA, the same function that logs at entry can be called at exit, with a flag to say which it is, so it's not much extra code.
It’s Fairman 
Re: Saving indicator values at entry so you can analyse trades later
How do you store this data for easy analysis? A CSV file per EA, with one row per trade and a column per value, is simple and opens in any spreadsheet. If you run several EAs, keeping the same column names across them makes it easy to combine the files later. Some people use a small database, but for most traders a CSV is enough. The main thing is to start logging early, since you can't go back and capture values for trades you've already taken without recalculating them, which is never quite the same.
It’s Fairman 