The History tab in MetaTrader 5 lists deals and orders, not trades. This script rebuilds each closed trade from its deals and writes one row per trade to a CSV file you can open in Excel, LibreOffice or Google Sheets.

Inputs
File 1: ClosedTrades_<login>_<period>.csv
One row per closed trade: OpenTime, CloseTime, Symbol, Type, Volume, OpenPrice, ClosePrice, StopLoss, TakeProfit, Commission, Swap, Fee, Profit, NetProfit, Magic, Comment, CloseReason, PositionTicket.
File 2: ClosedTradesByMagic_<login>_<period>.csv
One row per magic number and one row for all trades: Magic, Trades, Wins, Losses, NetProfit, GrossProfit, GrossLoss, LargestLoss, LongestLosingStreak, WinRatePct.
How to use
Notes
Account Recorder - balance, equity and day drawdown to CSV every minute (service)
A service that writes your balance, equity, floating result, margin and the drawdown from today's highest recorded equity to a CSV file every minute. Runs without a chart and never trades.
GotobiDays - include file to find Gotobi days (Japanese payment dates)
Include file with small functions to find the Gotobi days: the 5th, 10th, 15th, 20th, 25th and the last day of each month, moved back to the previous business day when they fall on a weekend or a holiday you list. Information only, no trading functions.
Accelerator Oscillator (AC)
The Acceleration/Deceleration Indicator (AC) measures acceleration and deceleration of the current driving force.
MACD Signals
Indicator edition for new platform.