Specifications – Development of an MQL5 Expert Advisor (Reverse Engineering)
Project context:
I have access to a real trading history consisting of more than 500 trades executed over a period of approximately 3 years. These trades have been exported into a CSV file containing all available information, including date, time, symbol, order type, entry price, and exit price.
Important:
I do not have access to the original trading strategy that generated these trades.
The goal of this project is therefore to reconstruct a trading logic through reverse engineering, based solely on the existing historical data. This project should be considered a reverse engineering task: all analytical methods, trading indicators, and quantitative approaches are acceptable as long as the required deliverables are met.
Main objective:
To develop an Expert Advisor (EA), preferably in MQL5 or alternatively in Python, capable of:
Reproducing at least 90% of the trades contained in the CSV file during backtesting
Being usable in the future, both in live trading conditions and for further backtesting
Relying exclusively on the provided historical data
Provided data:
A CSV file containing the full trade history
Each row represents a single trade and includes, among others:
Date
Time
Instrument (e.g. XAUUSD)
Order type (BUY / SELL)
Entry price
Exit price
The developer will be expected to:
Analyze the provided data
Identify recurring patterns, rules, or common conditions
Derive an exploitable and coherent algorithmic trading logic
Functional scope of the Expert Advisor:
The EA must be able to:
Identify entry conditions (BUY / SELL)
Determine exit conditions
Be primarily specialized for gold (XAUUSD), with the possibility of deployment on other assets
Manage:
Stop Loss
Take Profit
Trade duration (maximum trade duration of 5 hours)
Backtesting requirements:
The EA must be fully backtestable on MetaTrader 5
It must allow a direct comparison between:
Trades generated by the EA
Trades contained in the CSV file
Minimum requirement: ≥ 90% match rate (dates, trade direction, and acceptable timing tolerance)
Parameters and configuration:
Adjustable parameters, including:
Trading hours
Price and timing tolerances
Money management (risk percentage per trade or fixed lot size)
The strategy should allow future optimization
Technical constraints:
Programming language: MQL5 or Python
Platform: MetaTrader 5
Code must be:
Clean
Well-commented
Well-structured
Easy to modify and maintain
Full compatibility with the MT5 Strategy Tester is required
Expected approach (Reverse Engineering):
The project relies on a strong analytical and quantitative approach, which may include:
Statistical analysis of trade entries and exits
Detection of rules based on:
Time-based conditions
Volatility
Price levels
Technical indicators (such as market volume profile, Fibonacci retracements, supply and demand zones, order flow)
Progressive reconstruction of a coherent and robust trading strategy
The final strategy does not need to be identical to the original one, as long as it:
Reproduces the historical trades
Is usable for future trading
Is profitable
Expected deliverables:
The Expert Advisor source and compiled files (.mq5 + .ex5) or the Python code
A detailed documentation explaining:
The strategy logic
Available parameters
Known limitations
Required libraries (for Python-based solutions)
A backtesting report demonstrating:
The trade matching rate versus the CSV
Overall performance over at least 5 years
Project validation criteria:
The project will be considered successfully completed if:
The EA reproduces at least 90% of the trades from the CSV during backtesting
The code is functional and usable
The strategy logic is clear and properly documented
The strategy is profitable on XAUUSD
Detailed report required, explaining:
The full project workflow
The reasoning and analytical process
The research and analysis tools used
The technical implementation