Loading…

Restore Point Creator

Terminal global variables are how many home-grown MQL4 tools store settings and running state between chart reloads, and that state gets lost the moment MetaTrader is reinstalled, the terminal's data folder is reset, or a global variable is accidentally cleared. There is no built-in undo for that. This script snapshots every global variable whose name starts with a chosen prefix (so it only touches variables belonging to the tools you actually want backed up) into a plain text file, alongside a read-only inventory of every currently open order - ticket, symbol, type, lots, open price, stop loss, take profit and magic number. Restore mode reads the global variables back exactly as recorded. The position inventory is deliberately NOT replayed as new trades - silently reopening positions from an old snapshot risks duplicating live exposure if some of those trades are, in fact, still open, or opening positions the trader no longer wants if they were deliberately closed since the snapshot. Instead, restore mode prints the recorded inventory to the Experts log so the trader can compare it against what is actually open right now and decide what, if anything, needs manual action. Notes and limitations Global variables are restored exactly, overwriting any current value with the same name - if a tool is actively running and using one of those variables, restoring while it is attached can produce a value change it does not expect. Detach or pause tools that own the restored variables before restoring, if that matters for your setup. Open positions are recorded as a read-only inventory only. Restore mode never sends an OrderSend or OrderClose call - the trader remains fully in control of what happens to live trades, and the tool never risks doubling up exposure by silently reopening something from an old snapshot. Captures up to 500 global variables and 500 open positions per snapshot; a terminal with more than that in either category needs a narrower InpGlobalVarPrefix or is beyond what one snapshot file is meant to cover. The restore file format is a simple internal CSV-style layout specific to this script - it is not compatible with any other tool's export format.

Script · MT4 · v1.0 · Free

About Restore Point Creator

Restore Point Creator is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 3 settings, such as Mode, Restore file and Global var prefix. MQL source code included.

Files in the download: RestorePointCreator.mq4, RestorePointCreator.txt.

Settings

SettingDefaultWhat it does
ModeRP_MODE_SNAPSHOTSnapshot or Restore
Restore fileRestorePoint.txtFile under MQL4\Files
Global var prefixTool_Only global variables starting with this prefix are captured

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 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: Alerts · MT4 Script · MQL4 Source Code

MQL4 & MQL5 scripts · PolyMaria