Specification
MT5 EA/Robot Development and Live-Execution Requirements
I have developed and attached an MT5 Expert Advisor (EA/robot). The EA was developed with the help of ChatGPT and other AI platforms. However, although the code may compile and appear to work in backtesting, it does not always behave according to the strategy, rules, indicators, and trade-management logic that were originally designed.
I do not want another theoretical, experimental, or incomplete EA. I need the attached EA to be reviewed and improved so that the strategy written in the code is actually and reliably implemented in live MT5 trading, whether on a demo account or a real-money account.
1. The existing strategy must be preserved
First, carefully read and understand the attached source code, including:
- Entry rules
- Indicators and indicator conditions
- Buy and Sell logic
- Position management
- Stop Loss (SL)
- Take Profit (TP)
- Break-even
- Pyramid/scaling logic
- Reversal handling
- Lot-size management
- Any other rules already incorporated into the EA
Do not replace the existing strategy with a completely different strategy unless absolutely necessary. The objective is to make the existing designed strategy work correctly and consistently.
2. The EA must follow its own rules exactly
If the code says that a position should be opened under specific conditions, the EA must actually check those conditions and open the trade accordingly.
If the code says that a position should be managed in a particular way, the EA must execute that management correctly.
The EA should not simply compile successfully and then fail to follow its own trading logic on the live chart.
3. Pyramid / profit-based lot management
One important example is the pyramid method.
Suppose the initial fixed lot size is 0.01.
When the EA opens a position and the trade moves in the expected direction and becomes profitable:
- At the defined profit trigger, such as +$1 or +$2, the pyramid/scaling rule should become active.
- The next position may increase according to the predefined pyramid rules.
- The increase must happen only when the original position is profitable and the required conditions are confirmed.
However, if the position moves against the trade and becomes negative:
- The lot size must remain at the defined defensive size, such as 0.01.
- The EA must never increase the lot size simply because the trade is losing.
- There must be no accidental averaging-down or uncontrolled position enlargement unless explicitly included in the original strategy.
This logic must work reliably in live trading, not only in backtesting.
4. Reversal and losing trades
Another major problem I have experienced is that the EA sometimes opens a position correctly but then allows the trade to move against the intended direction and eventually closes at a loss instead of managing the position according to the defined strategy.
Therefore, carefully review the reversal-management logic.
The EA must correctly distinguish between:
- A normal temporary pullback
- A profitable continuation
- A confirmed weakening of the trade
- A genuine reversal
The EA should not close a potentially successful trade too early, but it also should not blindly hold a clearly invalid trade until a large loss occurs.
5. Live-chart execution is the priority
The most important requirement is real execution behavior.
I do not need an EA that only looks good in the source code or produces attractive backtest results.
The final EA must be designed so that the rules are actually executed correctly on a live MT5 chart, including:
- Correct indicator readings
- Correct candle/timeframe handling
- Correct Buy/Sell decisions
- Correct lot sizes
- Correct SL and TP placement
- Correct pyramid activation
- Correct position tracking
- Correct modification of existing positions
- Correct reversal handling
- Correct handling of multiple positions
- Correct execution after every tick/candle as required by the strategy
- Correct behavior after MT5 restart, reconnection, or temporary execution problems where relevant
6. No hidden or missing logic
Please identify any part of the existing code where the written strategy and the actual programming logic do not match.
For example, if the strategy says:
“Increase the lot only after the existing trade reaches a defined profit.”
but the code increases the lot regardless of whether the existing position is profitable, then this must be corrected.
Likewise, if a rule is defined but the EA never actually checks it, the missing implementation must be corrected.
7. Do not make the EA unnecessarily complicated
I want a simple, robust, rule-based EA, not an EA overloaded with unnecessary indicators, filters, or complicated algorithms.
Every rule in the final EA should have a clear purpose and should directly support the strategy already incorporated into the attached code.
Final Objective
My objective is simple:
Whatever trading strategy, indicators, rules, and position-management logic are incorporated into the attached EA must actually work as programmed when the EA is attached to an MT5 chart.
Please thoroughly audit the existing source code, identify why the EA is not behaving according to its intended rules, correct the implementation, and produce a reliable, compile-clean MT5 EA that can be properly tested in a demo account and subsequently used in a real MT5 environment.
Do not simply rewrite the EA from scratch or provide another theoretical version. Preserve the intended strategy, fix the implementation, and make the programmed rules actually execute correctly.
The final result should be judged by correct execution of the defined rules, not merely by whether the code compiles or whether a backtest appears profitable.