Blog Details

thumb
13 Jul 2026

Decompiling Custom MT4 Indicators: How to Recover EX4 Source Code for Indicators

Decompiling Custom MT4 Indicators: How to Recover EX4 Source Code for Indicators


Table of Contents

  • How Indicator EX4 Files Differ from EA EX4 Files
  • Why People Need to Decompile Custom Indicators
  • What Gets Recovered from an Indicator EX4
  • Indicator-Specific Output: Buffers and Drawing Functions
  • Submitting an Indicator for Professional Decompilation
  • Working With the Recovered Indicator Source
  • Common Modifications After Recovery

When most people think about EX4 decompilation, they picture Expert Advisors — trading robots that place and manage orders. But a significant portion of real-world decompilation work involves custom indicators: compiled EX4 files that draw chart overlays, paint signals, calculate values, or feed data into other tools. The underlying process is the same — recovering MQL4 source code from a compiled binary — but indicators have specific characteristics that make the recovered output look and behave differently from EA decompilation results.

This guide covers everything specific to custom indicator decompilation, from what makes indicator EX4 files distinct to how to work effectively with the recovered source code.

How Indicator EX4 Files Differ from EA EX4 Files

Custom indicators and Expert Advisors are both compiled from MQL4 source code into EX4 binary format using the same MetaEditor compiler. From the compiler's perspective, they are the same type of output. However, the internal structure of indicator code differs in important ways that affect what the decompiled output looks like.

The most significant difference is the indicator buffer system. Custom indicators define a set of named buffers using SetIndexBuffer() calls in the OnInit() function. Each buffer corresponds to a plot line, histogram, or signal that the indicator displays on the chart. In the decompiled output, these buffer registrations are one of the most reliably recovered elements — they tell you exactly how many values the indicator calculates per bar and what each one represents.

Indicators also have a characteristic OnCalculate() function (or the older start()function) that receives bar data and fills the indicator buffers. This is the core calculation loop. The control flow within this function is typically the most structurally complex part of the decompiled output, because it handles both the full history calculation and the per-bar update on new ticks.

Unlike EAs, indicators have no order management code. There are no OrderSend() or OrderClose() calls. This makes indicator source code in some ways easier to read after decompilation — the logic is entirely about calculation and display rather than trade execution. For someone who wants to understand what a custom indicator actually calculates, the decompiled output is usually quite readable even with generic variable names.

Why People Need to Decompile Custom Indicators

The common use cases for indicator decompilation parallel those for EAs, with a few differences specific to indicator workflows:

Lost source code

Developers who wrote a custom indicator years ago and lost the original MQ4 file — through a hardware failure, a backup gap, or a workspace reorganization — face the same problem as developers with lost EA source. The compiled EX4 is the only surviving artifact of the work. Professional ex4decompiler.com ices recover the MQ4 source from the compiled file, restoring the ability to modify, maintain, and document the indicator.

Understanding a purchased or received indicator

Many traders use custom indicators from third-party developers without any visibility into what the indicator actually calculates. Understanding the formula is sometimes necessary for signal interpretation, strategy development, or adapting the indicator to a different timeframe or instrument. Source code access makes the calculation transparent in a way that chart observation alone cannot.

Porting to MT5 or another platform

An indicator written for MT4 cannot run natively on MT5. Porting requires the MQL4 source code as a starting point. Without it, the developer must reverse-engineer the indicator's behavior from chart observation — a time-consuming process that often misses edge cases in the original logic. The article on covers the full porting process; recovering the source via decompilation is always the recommended first step.

Modifying or extending an indicator

Adding an alert function, changing the drawing style, adjusting the calculation period dynamically, or combining two indicators into one are all common modifications that require source code. Freelance MQL4 developers handle this type of work regularly, and decompilation is the standard route when clients can only provide the compiled EX4.

What Gets Recovered from an Indicator EX4

The same principles apply as for EA decompilation: the calculation logic is fully recoverable, original variable names are generally not recoverable in modern-build files, and comments are permanently lost. For indicators specifically, what is reliably recoverable includes:

  • The indicator properties block: period, applied price setting, drawing style, minimum and maximum values, levels
  • The complete buffer setup: how many buffers, their drawing styles, color assignments, and any label strings
  • The full OnCalculate() or start() logic: the calculation formula applied to bar data
  • All iMA()iRSI()iCustom(), and other indicator dependency calls with their parameter structures
  • Any alert functions and their trigger conditions
  • Input parameters, often including the display labels that appear in the indicator dialog

For indicators that call other custom indicators via iCustom(), the decompiled source will show the iCustom call with the indicator name and parameters, but the logic inside the called indicator is not recovered unless you also decompile that indicator separately. This is an important caveat when decompiling complex indicator stacks that chain multiple custom indicators together.

Indicator-Specific Output: Buffers and Drawing Functions

The buffer setup section of a decompiled indicator is usually one of the clearest and most useful parts of the output. Each SetIndexBuffer() call maps a buffer index to a double array that holds the indicator values. The number of buffers tells you how many separate plot lines or values the indicator calculates. The SetIndexStyle() calls reveal the visual presentation — line, histogram, arrow, etc. This section alone answers many questions about what an indicator displays before reading any of the calculation logic.

For indicators with multiple buffers where some are signal buffers and some are internal calculation buffers (marked with DRAW_NONE), the distinction is preserved in the decompiled output. You can identify which buffers correspond to visible chart elements and which are intermediate calculations used internally. This distinction is important when modifying the indicator, since changing a visible buffer and an internal calculation buffer have different implications.

Drawing functions specific to indicator output — SetIndexLabel()SetIndexEmptyValue()IndicatorShortName() — are typically recovered with their string arguments intact, since these strings must be stored in the binary for the platform to display them. This means the indicator's chart name and data window labels are often exactly as written in the original source.

Submitting an Indicator for Professional Decompilation

The submission process for indicator decompilation is identical to EA decompilation. Submit the EX4 file and specify what you are working with. Some services ask upfront whether the file is an EA or indicator; others identify this automatically during their initial file assessment. Either way, the decompilation workflow is the same — the output is an MQ4 file with the complete indicator source code.

Turnaround for indicator decompilation is typically similar to EA decompilation: 24 to 48 hours for standard files through the service at ForexMQ5. Indicators are sometimes structurally simpler than EAs (no trade management logic), which can make the human review step quicker. However, indicators that perform complex multi-pass calculations or call multiple custom sub-indicators may require additional analysis time.

One practical note on file submission: some traders have multiple related indicators that form a system — a signal indicator, a filter indicator, and perhaps a dashboard indicator that aggregates their outputs. If you need source code for all of them, submitting the full set at once is generally more efficient than submitting them individually, and allows the service to note any inter-indicator dependencies in the output.

Working With the Recovered Indicator Source

The same starting workflow applies as for EA decompilation: compile the recovered MQ4 in MetaEditor first, verify it compiles without errors, then attach it to a chart and compare the visual output to the original compiled indicator. For most standard indicators — moving averages, oscillators, channel indicators — the visual output of the recompiled code should match the original exactly.

For indicators with complex multi-bar calculations (anything that uses lookback periods, iterative smoothing, or requires a warmup period), confirm that the indicator values match after the warmup period has elapsed. Early bars may differ slightly during warmup, but values should converge to match the original as enough bars accumulate.

Variable renaming in indicator source follows the same approach as for EAs. Start with the buffer arrays — they are the most important named elements and they interact with the rest of the code at many points. Once you understand which double array corresponds to which chart line, the calculation logic that populates those arrays becomes much clearer, and renaming the intermediate variables in the calculation chain is straightforward.

Common Modifications After Recovery

The most common modifications traders and developers make to recovered indicator source code:

Adding email or push notification alerts

Many downloaded indicators display signals visually but have no alert function. Adding Alert()SendMail(), or SendNotification() calls to the signal detection logic is straightforward in the source code. The recovered MQ4 makes the exact signal conditions explicit, so the alert conditions can be written to match precisely.

Adjusting calculation parameters

Changing a period from a fixed value to an input parameter, or adjusting the calculation formula to test a variant, requires source code access. Common examples include making a smoothing period user-configurable, testing alternative applied price options, or modifying how the indicator handles gaps in price data.

Adding to an EA

  • Embedding an indicator's calculation logic directly into an EA, rather than calling it externally via iCustom(), can improve execution performance and simplifies deployment. The recovered indicator source provides the calculation code needed to make this embedding straightforward. The complete ex4decompiler process applies once the indicator logic is embedded, to verify the combined behavior is correct.

Converting to MT5

The MQL4-to-MQL5 translation for indicators follows the same general patterns as for EAs, with the additional consideration that MT5's indicator structure uses different event functions and the buffer system, while conceptually similar, has some syntax differences. Starting with clean, recovered MQ4 source makes this conversion significantly more reliable than attempting to reverse-engineer the indicator's behavior from chart observation alone.

We may use cookies or any other tracking technologies when you visit our website, including any other media form, mobile website, or mobile application related or connected to help customize the Site and improve your experience. learn more

Allow