How to start with MQL5 - page 48

 

Introduction to MQL5 (Part 39): Beginner Guide to File Handling in MQL5 (I)

Introduction to MQL5 (Part 39): Beginner Guide to File Handling in MQL5 (I)

In this article, we'll look at how MQL5 handles files, where files are kept on your computer, and how to open, read from, write to, and close them correctly. Practical use cases, including data analysis, strategy logging, configuration storage, and data exchange among various MQL5 programs, will also be examined. We will take a project-based approach, as is customary in this series. Instead of studying file handling separately, we will use it immediately in a real-world project. We will write an MQL5 script that functions as a basic trading log in this article. The script will automatically create a file and record account history information, including trade ticket, symbol, order type, lot size, open time, open price, stop loss, take profit, closing time, close price, profit in dollars, and trade result, when it is activated.
Introduction to MQL5 (Part 39): Beginner Guide to File Handling in MQL5 (I)
Introduction to MQL5 (Part 39): Beginner Guide to File Handling in MQL5 (I)
  • 2026.02.11
  • www.mql5.com
This article introduces file handling in MQL5 using a practical, project-based workflow. You will use FileSelectDialog to choose or create a CSV file, open it with FileOpen, and write structured account headers such as account name, balance, login, date range, and last update. The result is a clear foundation for a reusable trading journal and safe file operations in MetaTrader 5.
 

Introduction to MQL5 (Part 40): Beginner Guide to File Handling in MQL5 (II)

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.

Introduction to MQL5 (Part 40): Beginner Guide to File Handling in MQL5 (II)
Introduction to MQL5 (Part 40): Beginner Guide to File Handling in MQL5 (II)
  • 2026.02.17
  • www.mql5.com
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.
 
Hello everyone. I need help setting this up. Can anyone help?
 
Coli Bowie #:
Hello everyone. I need help setting this up. Can anyone help?

You can start here:

Trading Platform - MetaTrader 5 Help

Next time, try to be more specific with your question - it’ll help others give better answers.

Trading Platform - MetaTrader 5 Help
Trading Platform - MetaTrader 5 Help
  • www.metatrader5.com
The Trading Platform is the trader's working tool, providing all the necessary features for a successful online trading. It includes trading...
 

Introduction to MQL5 (Part 41): Beginner Guide to File Handling in MQL5 (III)

Welcome to Part 41 of the Introduction to MQL5 series! In this article, we continue our beginner's guide to file handling in MQL5 by building on everything we have learned so far. In the previous parts, we explored how to create files, write structured trade data into them, and organize both entry and exit information in a readable trading journal. At this point, you already understand how files work in MQL5 and how to store trading data safely in a persistent format

Welcome to Part 41 of the Introduction to MQL5 series! In this article, we continue our beginner's guide to file handling in MQL5 by building on everything we have learned so far. In the previous parts, we explored how to create files, write structured trade data into them, and organize both entry and exit information in a readable trading journal. At this point, you already understand how files work in MQL5 and how to store trading data safely in a persistent format.

Introduction to MQL5 (Part 41): Beginner Guide to File Handling in MQL5 (III)
Introduction to MQL5 (Part 41): Beginner Guide to File Handling in MQL5 (III)
  • 2026.02.19
  • www.mql5.com
Learn how to read a CSV file in MQL5 and organize its trading data into dynamic arrays. This article shows step by step how to count file elements, store all data in a single array, and separate each column into dedicated arrays, laying the foundation for advanced analysis and trading performance visualization.
 

Introduction to MQL5 (Part 42): Beginner Guide to File Handling in MQL5 (IV)

Introduction to MQL5 (Part 42): Beginner Guide to File Handling in MQL5 (IV)

Welcome back to Part 42 of the Introduction to MQL5 series. Many traders keep their trade history in a CSV file containing profit and loss values for closed trades, but they analyze it only as a table. Whether viewed in Excel or as a raw CSV document, the data remains static and fragmented. You can see individual results, but cannot quickly evaluate balance progression, drawdown dynamics, or the cumulative impact of each trade directly on the MetaTrader 5 chart. The information exists, yet it is not visually integrated into the trading environment where analysis naturally takes place.
Introduction to MQL5 (Part 42): Beginner Guide to File Handling in MQL5 (IV)
Introduction to MQL5 (Part 42): Beginner Guide to File Handling in MQL5 (IV)
  • 2026.02.27
  • www.mql5.com
This article shows how to build an MQL5 indicator that reads a CSV trading history, extracts Profit($) values and total trades, and computes a cumulative balance progression. We plot the curve in a separate indicator window, auto-scale the Y-axis, and draw horizontal and vertical axes for alignment. The indicator updates on a timer and redraws only when new trades appear. Optional labels display per-trade profit and loss to help assess performance and drawdowns directly on the chart.