What Is Saved

On guiDeinit (when autostate enabled), snapshots:

  • Checkbox / radio checked state
  • Edit text
  • DropDown selection
  • Autostate-tracked menu rows (checked/enabled)

Keying

(chart window, short_name, object type, label-or-slot)

Two restorable objects of the same type with the same visible label in one session can collide (last snapshot wins). Use distinct labels or rely on internal slot assignment for dropdowns/edits.

Flags and Patterns

  • guiInit(..., autostate_enabled = 0) — disable save and restore.
  • guiHasRestoredState(gui_id, handle)true when restore applied on this attach.
  • guiAddCheckbox / guiAddRadioinitial_checked / initial_selected skipped when restore already applied.

Scope

Process-local RAM only. Cleared when MT4 exits. Replacing guipro.dll while MT4 is running clears caches on load (stale keys from an older DLL are not applied).