Can an ex5 EA behavior be reverse-engineered statistically?

 

I’m curious about something.

Many traders buy closed-source ex5 Expert Advisors and have no real idea how they work internally.

After observing a few hundred trades, do you think it’s possible to infer an EA’s behavior statistically?

For example:

  • Detecting Martingale or Grid behavior
  • Identifying lot progression patterns
  • Estimating whether it uses recovery techniques
  • Determining if it performs better in trending or ranging markets
  • Estimating whether entries are more likely based on breakouts, mean reversion, or trend following

Obviously, without access to the source code, we can never know the exact implementation, but I’m wondering how far statistical analysis can go.

Has anyone tried something similar? If so, how reliable were the results?


 
Marco Savia:

I’m curious about something.

Many traders buy closed-source ex5 Expert Advisors and have no real idea how they work internally.

After observing a few hundred trades, do you think it’s possible to infer an EA’s behavior statistically?

For example:

  • Detecting Martingale or Grid behavior
  • Identifying lot progression patterns
  • Estimating whether it uses recovery techniques
  • Determining if it performs better in trending or ranging markets
  • Estimating whether entries are more likely based on breakouts, mean reversion, or trend following

Obviously, without access to the source code, we can never know the exact implementation, but I’m wondering how far statistical analysis can go.

Has anyone tried something similar? If so, how reliable were the results?


Right out of the gate, I'm going to start with what not to do:

"Below are the examples of serious Market Terms of Use Agreement violations (https://www.mql5.com/en/market/rules, § IX)...

Copying, selling, licensing, distribution, transmission, modifying, adaptation, translation, development of derivative products, decompilation, reverse engineering, disassembling or other actions directed to deriving source codes of the Products distributed via Market service, unless otherwise permitted" (Rules of Using the Market Service, § IX(8)).

The ability to reverse engineer any MQL5 file depends on the context in which the ex5 was posted/shared, the specificity of the the file description therein, and the programming experience of the "engineer." Today, I can certainly imagine that AI could be of great assistance in identifying the underlying components/logic by way of uploading a chart image to AI, for example.

I have done that (without AI) a few times in the past only where legal. In those cases, traders were "showing off" their trading strategies without sharing. That is why I don't post anything anywhere that I want to keep private.

Keep in my that if you purchased a file, there are likely contractual terms prohibiting reverse engineering.

Rules of Using the Market Service
Rules of Using the Market Service
  • www.mql5.com
General Provisions and Conditions of Use service Market
 

Right now with all these AI models It's possible to reverse engineer any piece of software. You don't need exact copy of the original source. You can achieve the same end results with different code.

For Indicators, graphical interfaces and features, obviously this is easier. Everyone with the right skills could copy the design, functionality and settings.

For EAs/trading robots, there are specific proven methods to reverse engineer the trading logic and you don't even need the ex5 file.  All you really need is the trading history. In this case we can obtain it with simple backtesting (if we have access to ex5 file) or if the history is presented somewhere publicly. Then you can find the exact trading logic with brute force/data mining. But this is very high level task!  Real hacker level stuff.  Very few people know how to do this.  Even with the help of AI you still need to know how to do it manually in order to create the right prompts and then to assemble and implement the code correctly. AI simply speeds things up.

If the EA is not purely technical, but uses some external data, like news, economic analysis, calendars etc.  this will make things a bit harder, but not impossible. Just adds additional data sets in the mix.  

 
Marco Savia :
After observing a few hundred trades, do you think it’s possible to infer an EA’s behavior statistically?

It is not easy, but this is one of the most reliable methods.

Moreover, any hypothetical and theoretical idea must always undergo practical and empirical testing.
During the execution of tests (checks), some real and objective data is generated, which can only be determined as corresponding to hypothetical statements using statistical methods (statistics will answer whether the hypothesis was true or not).

For example.

Someone calculated the stability (expected performance) of something.

Next comes the testing of samples, methods, and techniques; the more the better, but the necessary, optimal number of tests (checks) is also determined by statistics and probability theory.

Therefore, if you want to understand something, then, for example, machine learning is ideal for your task.

You set a goal, a hypothesis, for example, a classifier or regression, and by studying the results obtained, you will come to the desired answer.
Correspondence of something -> to something.

 
Marco Savia:

I’m curious about something.

Many traders buy closed-source ex5 Expert Advisors and have no real idea how they work internally.

After observing a few hundred trades, do you think it’s possible to infer an EA’s behavior statistically?

For example:

  • Detecting Martingale or Grid behavior
  • Identifying lot progression patterns
  • Estimating whether it uses recovery techniques
  • Determining if it performs better in trending or ranging markets
  • Estimating whether entries are more likely based on breakouts, mean reversion, or trend following

Obviously, without access to the source code, we can never know the exact implementation, but I’m wondering how far statistical analysis can go.

Has anyone tried something similar? If so, how reliable were the results?


Yes you cannot get the exact implementation, but as far as statistics go, you can deduce, all of, or each of those examples you mentioned. Of course, with the right skill, tools, and dedication.

 

Several years ago, a client (I was a freelancer) and I managed to guess the strategy of an EA that was in the top 10 of the market at the time.

He simply noticed that the EA's trading was highly correlated with signals from certain indicators. We conducted research and managed to identify a strategy (consisting of several indicators) that ensured 100% match of entries with that top EA on the market.

At first I implemented exactly the same EA, later we developed an improved version. I don't know what happened to that guy. I haven't spoken to him since I implemented his requirements specification.

We didn't use any artificial intelligence (it didn't exist back then), machine learning, or any of those other fancy terms you like to throw around on forums to sound cool.

 
Vladislav Boyko #:
Several years ago, a client (I was a freelancer) and I managed to guess the strategy of an EA that was in the top 10 of the market at the time.

This wasn't an isolated incident.

Sometimes people would send me an ex4/ex5 file (or even a screenshot) and ask me to convert it to source code. Before turning someone down, I usually did a little googling. Several times, I was able to simply find the source code in codebase or on the forum.

 

Not really, specially of mql5 EAs, they have very very secure system. 

But some professional traders can understand the basic of how the EA is working by just looking at the historical trades, the stats sheet like average win and loss, SL... TP placed during the opening of a position... the life span of a position and such.