Strategy State Debug Panel
An EA that tracks a regime, a signal score, or a stage in a state machine usually has no way to show that internal state without the developer building a bespoke panel for every single project. Many EAs already publish exactly this kind of value through GlobalVariableSet so other tools (or the same EA across restarts) can read it back - but nothing displays that published state on the chart itself. This indicator scans the terminal's global variable list, keeps only the names that start with a configurable prefix, and renders each one as a labelled row: name on the left, current value on the right. A value that changed on the most recent refresh is briefly highlighted in a different colour, so a state machine advancing through its stages or a score recalculating on every tick is visible without opening the Global Variables window and hunting through an unfiltered, unlabelled list by hand. The prefix filter is not optional. The terminal's global variable list is shared across every chart and every running program, so without a filter this panel would mix state from unrelated EAs and libraries into one undifferentiated list. Requiring a prefix means the panel only ever shows what one specific EA (or a deliberately chosen family of EAs sharing a prefix) intended to publish. The panel re-scans the full global variable list on every refresh rather than caching names between refreshes, because GlobalVariablesTotal() and GlobalVariableName() give no change notification. A variable an EA stops publishing (because it deleted it, or the EA was removed) disappears from the panel on the very next refresh instead of lingering as a stale row. Notes and limitations - Global variables only ever hold a double. An EA publishing an enum/state as a number (0, 1, 2...) works well; a value that is conceptually text needs its own encoding scheme on the publishing side - this panel only ever prints the raw number. - The panel is read-only. It cannot change any EA's behaviour, only display what the EA already chose to publish. - Terminal global variables persist across terminal restarts by default until MetaTrader's own expiry housekeeping removes them, so a stale variable from an EA that is no longer running can still appear until it is cleared - check the EA's own cleanup logic if a row seems to belong to nothing currently active. - All rows are plain chart label objects, prefixed and removed cleanly in OnDeinit.
Indicator · MT4 · v1.0 · Free
About Strategy State Debug Panel
Strategy State Debug Panel is an indicator for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 11 settings, such as Prefix, Max rows and Refresh secs. MQL source code included.
Files in the download: StrategyStateDebugPanel.mq4, StrategyStateDebugPanel.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Prefix | EA_ | Only show global variables whose name starts with this |
| Max rows | 20 | Maximum number of variables shown at once |
| Refresh secs | 1 | Panel refresh interval, in seconds |
| Corner | CORNER_LEFT_UPPER | Panel corner |
| X offset | 10 | Horizontal offset from the corner, in pixels |
| Y offset | 20 | Vertical offset from the corner, in pixels |
| Font size | 9 | Panel font size |
| Text color | clrWhite | Row text colour |
| Stale color | clrSilver | Colour used for a value that has not changed since the previous refresh |
| Fresh color | clrLimeGreen | Colour used for a value that just changed this refresh |
| Fresh hold secs | 3 | How long a changed value stays highlighted before fading back |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the indicator from the Navigator onto a chart and adjust the settings.
Tags: Buy/Sell Arrows · Alerts · MT4 Indicator · MQL4 Source Code