Loading…

Custom Indicator Parameter Prober

Calling a custom indicator through iCustom() means supplying its input parameters positionally, in the right order, with no compiler help and usually no source to check against. Get the count or the order wrong and the indicator silently falls back to its own defaults for whatever was missing - there is no error, just a result that is quietly not what was asked for. There is no way to ask MQL4 or MQL5 what a compiled indicator's real input list is. FileOpen cannot even reach the compiled .ex4/.ex5 file to look - the terminal's file functions are sandboxed to MQL4\Files or MQL5\Files, and the Indicators folder is outside that sandbox entirely, by design, without a DLL. So this script does not read anything; it experiments. It calls the indicator with zero parameters, then one, then two, and so on, substituting a distinctive sentinel value into each new slot, and watches whether the output changes each time a slot is added. A change is treated as evidence that slot corresponds to a real input the indicator actually uses; no change across several additional slots is treated as evidence that the input list has probably been exhausted - evidence, not proof, in both directions. Because a parameter might affect a different buffer than the one being watched, the probe repeats across a small number of buffer indices rather than trusting a single one. It finishes with the same buffer-liveness scan used by the standalone buffer inspector, run with the indicator's own default inputs, as a second, independent data point. Treat every number this prints as a lead to check by hand, not a verified fact. The alternative - not checking at all and guessing the parameter list from a forum post - is worse, but it is a low bar. Notes and limitations - This is a behavioural heuristic, not reflection. It can under-count (an input whose effect only shows up on a buffer or a shift that was not checked) and it can over-count (a parameter that happens to trigger a different code path without being a meaningful trading input). - An input whose default already equals the sentinel value produces no visible change and is missed. Re-run with a different InpSentinelValue if a suspiciously flat result is returned. - The probe only varies parameter count, never type. An indicator expecting a string or bool in a given position is still being sent a double; both platforms coerce it, but the coerced value may not exercise that input the way a real string or bool would. - On MQL5, a handle that never calculates within the probe's short retry window is reported the same as one that returned no data - both show as EMPTY. A genuinely slow-to-calculate indicator (very long lookback, heavy internal work) can be misread as unreactive; re-run if a result looks suspiciously flat. - This complements, and partly overlaps, the standalone buffer inspector script - each is self-contained on its own, since every CodeBase submission has to stand alone.

Script · MT4 · v1.0 · Free

About Custom Indicator Parameter Prober

Custom Indicator Parameter Prober is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 6 settings, such as Indicator name, Max params to probe and Sentinel value. MQL source code included.

Files in the download: CustomIndicatorParameterProber.ex4, CustomIndicatorParameterProber.mq4, CustomIndicatorParameterProber.txt.

Settings

SettingDefaultWhat it does
Indicator nameCustom indicator name, as it appears in the Navigator
Max params to probe8Highest optional parameter count to try (0..N)
Sentinel value123456.0Distinctive value passed into each probed parameter slot
Buffers to check2How many buffer indices (0..N-1) to watch for a reaction
SymbolSymbol (blank = current chart symbol)
PeriodPERIOD_CURRENTTimeframe

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