Loading…

Resource Trend Recorder

A resource leak - an EA that never deletes the objects it draws, a GlobalVariable count that keeps growing, memory creeping upward across a long session - is invisible in a single snapshot. The only way to catch it is a trend, and MetaTrader keeps no history of its own resource counters between restarts. This tool samples terminal memory usage, the count of chart objects on this chart, GlobalVariables, and open/historical orders on a fixed interval and appends one row per sample to a CSV. It is a recorder, not an analyser - the point is a clean, restart-tolerant log a spreadsheet or script can chart afterward. The log is opened in append mode, not overwritten, so restarting the EA or the terminal does not lose the trend. A restart is written as its own marker row (with the deinit reason code) rather than left implicit, so a gap or a step in the trend can be told apart from a genuine change in resource usage. Notes and limitations - Recording only happens while the EA is attached and the terminal is running - it cannot record a trend across a period the terminal was closed. - Chart-object and subwindow counts are only meaningful for the chart this instance is attached to, not the whole terminal. - Memory figures come from TerminalInfoInteger and reflect the whole terminal process, not this EA in isolation. - The CSV grows without limit; nothing in this tool rotates or trims it.

Expert advisor · MT5 · v1.0 · Free

About Resource Trend Recorder

Resource Trend Recorder is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 3 settings, such as Sample interval min, Log file name and Use common folder. MQL source code included.

Files in the download: ResourceTrendRecorder.ex5, ResourceTrendRecorder.mq5, ResourceTrendRecorder.txt.

Settings

SettingDefaultWhat it does
Sample interval min5Minutes between samples
Log file nameResourceTrendRecorder_log.csvOutput file, MQL5\Files sandbox
Use common folderfalsetrue = MQL5\Files\Common\, shared across terminals on this machine

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the script onto a chart to run it once.

Download the PDF guide

Tags: Trend · Trading Sessions · Alerts · MT5 Expert Advisor · MQL5 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria