Export Position History V1 - MetaTrader 5 Script | Trading Script Download - MT4/MT5 Resources



This script exports closing history from MT5 retail hedging accounts selected between two dates. The resulting file is a CSV and can be opened/imported using any spreadsheet software.
For version 2 script content, please visit https://www.mql5.com/en/code/27683
It only supports retail offset accounts (Forex).
To export the entire transaction history, leave the start and end dates at their default values.

The CSV file will be opened automatically using an associated Windows program such as Microsoft Excel or Ron's CSV Editor.
The output CSV file can be located at: Terminal > Files > Open data folder > MQL5\Files\<file name>
Export the following data columns:
Closed positions can be reconstructed in a more convenient way than in the "History" tab of the MetaTrader 5 terminal.
CSV files can be opened using Ron's CSV Editor using Microsoft Excel or better.
https://www.ronsplace.eu/Products/RonsEditor
In order to be able to calculate running balances in the correct chronological order, the option " Sort positions by: " must be set to " Closing time " so that the position list is sorted by closing time (instead of opening time).
Attachment download
📎 dummy.mq5 (0.67 KB)
📎 export_history_positions.mq5 (26.57 KB)
Source: MQL5 #21434
Exporting Position History V1 - Important Points Before Using the MetaTrader 5 Script
This page has been supplemented with structured instructions, focusing on the purpose of trading scripts, MT4/MT5 platform compatibility, testing procedures and risk control. Before downloading or deploying, it is recommended to first determine whether it is consistent with your own variety, cycle and account environment.
Suitable for who to use
- Users who want to quickly screen trading scripts and are willing to do simulation verification first.
- People who need to compare MT4/MT5 EAs, indicators, scripts or source code projects.
- Traders who wish to record backtests, parameters and risk boundaries before placing a trade.
Testing and risk control suggestions
- First verify the default parameters in the strategy tester or demo account, and then adjust the symbol, period, spread and trading period one by one.
- Scalping, grid, martin, and high-frequency strategies should focus on observing maximum drawdowns, consecutive losses, slippage, and trading frequency.
- It is not recommended to run any document directly on the real disk. At least observe the simulated disk performance for 2-4 weeks first.
FAQ
Can MT4 and MT5 be used interchangeably?
Usually cannot be used directly. EX4/MQ4 corresponds to MT4, EX5/MQ5 corresponds to MT5, and the source code needs to be compiled in the corresponding MetaEditor.
Is this resource guaranteed to be profitable?
cannot. EAs, indicators and scripts can only be used as trading tools, and the results depend on parameters, market environment, spreads, slippage and risk control.
What else can I continue to watch?
Forex EA download , foreign exchange indicator download , EA evaluation , MQL5 CodeBase .
English Search Notes
This page is also optimized for English search intent around Export Position History V1 - MetaTrader 5 script . Related search terms include: trading script, MT4 script, MT5 script. Test any Forex EA, Expert Advisor, MT4/MT5 indicator, script or MQL source code with historical data and a demo account before live trading.
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •