EA-1620 · Utility

Demo_FileWriteArray

This EA is a file-writing utility that collects bid/ask price data and datetime stamps on every tick, storing them in a structured array. Once the array reaches its capacity (20 elements), it writes the accumulated data to a binary file and resets the counter. It serves as a demonstration of MQL5's FileWriteArray function for persisting structured data to disk.

Open the interactive view (equity curve, symbol switch)

Key facts

CategoryUtility
RiskSafe
Rating★★☆☆☆
TypeUtility tool
TimeframesM1, M5, M15, M30, H1, H4, D1
Indicators—
AuthorMetaQuotes Software Corp.

Backtest results (H1, about 1 year)

Not backtested yet — this EA could not be converted automatically.

Strategy analysis

This EA has no trading strategy concept; it does not execute any entry or exit operations and functions solely as a data logging tool. On each incoming tick, it retrieves the current server time, the current symbol's bid and ask prices, and stores this data into a pre-allocated prices struct array with a size of 20. Position sizing and money management are entirely inapplicable since the EA does not involve any trading activity. When the array counter reaches the preset size, the EA calls the WriteData function to write the entire array to a file in binary format via FileWriteArray, then resets the counter to continue collecting data. During deinitialization, if the array contains unsaved data (count less than size), it also writes the remaining records to the file to prevent data loss. The overall logic is straightforward and simple, serving as a pure data collection and file I/O demonstration program.

Strengths

  • Batch writing of struct arrays to file using FileWriteArray for efficient binary serialization
  • Handles remaining unsaved data in OnDeinit to prevent data loss on EA shutdown
  • Clean and concise code serving as an excellent official demonstration of FileWriteArray functionality

Weaknesses

  • Lacks detailed error handling for file write failures; only prints error code without recovery mechanism
  • Array size is hard-coded to 20 with no input parameter for user-configurable buffer size
  • No data deduplication or repeat-write protection; EA restart may cause duplicate or incomplete records in the file

Possible improvements

  • Make the array buffer size (size=20) a configurable input parameter for greater flexibility
  • Add write verification logic such as read-back validation or logging the number of bytes written to confirm data integrity

Risk assessment

Overall risk: Safe

  • The EA performs no trading operations, posing no financial risk
  • File operations use FILE_READ|FILE_WRITE mode which may cause file access conflicts in multi-instance scenarios

Evaluation scores

Code quality4.0
Strategy logic1.0
Risk management5.0
Robustness3.0
Innovation1.0
Documentation3.0
Overall2.8

Parameters

ParameterDefaultDescription
InpFileNamedata.binOutput binary file name
InpDirectoryNameSomeFolderOutput file directory name

Similar Utility EAs

Backtests are historical simulations and do not guarantee future results. Not financial advice.

Get the weekly Arena report

One email a week: ranking changes, new signals and new research. No spam; unsubscribe any time.