Export Positions History:
The script exports history of closed positions to .csv file.
It supports only retail hedging accounts (Forex).
To export the entire trading history, keep Start date and End date at their default values (1970.01.01 00:00:00).
You can see that all the closed positions were reconstructed in the same way as in the History tab of the MetaTrader 5 terminal.
My script tries to stick to the same representation as in the History tab of the MetaTrader 5 terminal. If you prefer a convenient way to display the history of deals ordered by close time, you can use my other script "Export Deals History"