You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Forum on trading, automated trading systems and testing trading strategies
How to start with MQL5
Sergey Golubev, 2026.02.18 06:22
Introduction to MQL5 (Part 40): Beginner Guide to File Handling in MQL5 (II)
Welcome back to Part 40 of the Introduction to MQL5 series. In the previous article, we laid the foundation for file handling in MQL5 by learning how to create and open files using FileSelectDialog and FileOpen. We also built the structure of a simple trading journal and recorded essential account information into a file in a safe and organized way. In this second part, we will continue building on that foundation by focusing on exporting actual trading history into the journal file. You will learn how to access account history within a specified time range and how to extract important trade details such as ticket number, symbol, order type, lot size, open and close times, prices, profit, and trade result. These records will then be written into the journal in a structured and readable format.
This article is written with beginners in mind, just like the others in this series. Every action's reasoning is meticulously dissected, and each step is described in detail. By expanding the trading journal script, we will continue to use the same project-based methodology. You will get a practical grasp of reading trade history and storing it in files in a persistent manner by the end of this article. This is crucial for logging, analysis, reporting, and strategy evaluation in real-world MQL5 applications.