Indicator Buffer Inspector
Calling iCustom() on someone else's compiled indicator means guessing which buffer index holds the value you actually want. The indicator's source may not be available, its documentation may be wrong or missing, and the only honest way to find out is to read what each buffer index actually returns. Doing that by hand means writing a throwaway script, running it, deleting it, and repeating for the next indicator - tedious enough that people just guess buffer 0 and hope. This script is that throwaway tool, kept general enough not to need rewriting each time. Point it at a compiled indicator's name and it calls iCustom for buffer indices 0 through a configurable maximum, prints the last few bars' worth of values for each one, and flags any buffer whose sampled values are all zero or all EMPTY_VALUE as looking unused - the pattern an index past the indicator's real buffer count, or a genuinely inactive buffer, tends to produce. MQL4 gives a script no way to ask a compiled indicator how many buffers it actually declared - there is no reflection. So this is a probe, not a query: it tries a range of indices and reports what came back, honestly labelled as a heuristic rather than a guaranteed buffer count. A buffer that legitimately holds only zeros in its meaningful range - an oscillator sitting exactly on its centre line for the sampled bars, say - can be flagged as "looks unused" when it is not; read the actual values printed, not just the flag, before deciding. Notes and limitations - The indicator is called with its own default input values - this script does not know and cannot pass the indicator's custom parameters. It answers "which buffer is which," not "what does this indicator say with these specific settings." - "Looks unused" is a heuristic based on the sampled bars only. An indicator that legitimately returns zero or EMPTY_VALUE across the whole sample window - a signal buffer that has not fired recently, for example - is flagged the same way a genuinely nonexistent buffer would be. Confirm with a longer sample or different bars before concluding a buffer does not exist. - Probing stops early once a buffer index comes back invalid (MQL4: a real MQL error from the call; MQL5: CopyBuffer returning -1) - that generally means the index is past the indicator's real buffer count, not that the buffer legitimately holds no data. - On MQL5, a freshly created indicator handle can need a short moment to finish its first calculation; the script waits briefly before reading, and notes it in the log if the wait was not enough. - This script only reads values; it does not modify, attach, or remove any indicator from a chart.
Script · MT4 · v1.0 · Free
About Indicator Buffer Inspector
Indicator Buffer Inspector is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 5 settings, such as Indicator name, Max buffers to probe and Bars to show. MQL source code included.
Files in the download: IndicatorBufferInspector.ex4, IndicatorBufferInspector.mq4, IndicatorBufferInspector.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Indicator name | Custom indicator name, as it appears in the Navigator | |
| Max buffers to probe | 8 | How many buffer indices to try (0..N-1) |
| Bars to show | 5 | How many recent bars to sample per buffer |
| Symbol | Symbol (blank = current chart symbol) | |
| Period | PERIOD_CURRENT | Timeframe |
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 → Scripts.
- 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 script onto a chart to run it once.
Tags: Buy/Sell Arrows · Alerts · MT4 Script · MQL4 Source Code