Discussing the article: "Introduction to MQL5 (Part 40): Beginner Guide to File Handling in MQL5 (II)"
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
Check out the new article: Introduction to MQL5 (Part 40): Beginner Guide to File Handling in MQL5 (II).
Create a CSV trading journal in MQL5 by reading account history over a defined period and writing structured records to file. The article explains deal counting, ticket retrieval, symbol and order type decoding, and capturing entry (lot, time, price, SL/TP) and exit (time, price, profit, result) data with dynamic arrays. The result is an organized, persistent log suitable for analysis and reporting.
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.
Author: Israel Pelumi Abioye