MT5 Grid EA with Auto Re-Anchor, Anti-Failure Logic, and Global Take Profit System

Tâche terminée

Temps d'exécution 12 jours
Commentaires du client
approved! thank you Rodrigue
Commentaires de l'employé
Happy to work with you

Spécifications

💼 Job Description (full text for MQL5 Jobs)

Project Overview

I need a MetaTrader 5 Expert Advisor (MQL5, Hedge account) that executes a grid-based anti-failure strategy.
The EA should anchor at the latest top (highest high), place BUY LIMIT orders at predefined retracement levels, and close all positions simultaneously when the average price reaches a global Take Profit target (in %).

After the global closure (TP, SL, or manual), the EA must cancel all remaining pending orders, re-anchor automatically to the latest high, and rebuild the entire grid.

⚠️ I already have a partial version of this system.
The main issue to fix is: when one trade closes at TP, other pending orders remain stuck on the chart.
I need it to close everything, reset, and start over cleanly after each cycle.


Strategy Logic

1. Anchor Logic (Top Reference)

  • Anchor at the highest high of a user-defined timeframe (e.g. D1) within a defined lookback period (e.g. 10,000 bars).

  • Re-anchor only if:

    1. There are no open BUY positions, and

    2. A new high ≥ (previous_anchor * (1 + ReanchorThrPct / 100)) occurs.

  • While any BUY position remains open, the anchor must not change.

  • After all positions close, the EA checks for a new high and rebuilds the grid.


2. Grid Placement (BUY LIMIT Orders)

  • Up to 10 levels, each with:

    • LevelPctN → retracement % from anchor top

    • LotN → fixed lot size for that level

  • BUY LIMIT price = AnchorHigh * (1 - LevelPctN/100)

  • Prevent duplicates:
    If a pending order already exists within PriceTolPts (price tolerance in points), do not resend it.

  • Orders use DeviationPts (slippage/deviation setting).


3. Global Take Profit by Average Price

  • When one or more BUY positions are open (same Magic Number), calculate volume-weighted average entry price.

  • Set global Take Profit = AvgPrice * (1 + TP_Percent / 100)

  • All open BUY trades must share this same TP.

  • If the difference between current TP and target TP > ModifyTolPts , the EA updates all positions’ TP accordingly.


4. Reset & Re-Arm Sequence
After all BUY positions are closed:

  1. Cancel all pending BUY LIMITs for that Magic Number.

  2. Recalculate AnchorHigh (check for new top using the rules above).

  3. Rebuild the grid with the same parameters from the new anchor.

This reset must also trigger if trades close via TP, SL, or manual closure.
Use OnTradeTransaction with DEAL_ENTRY_OUT to detect when all positions are closed.


Magic (ulong)
AnchorTF (ENUM_TIMEFRAMES)
BarsLookback (int)
ReanchorThrPct (double)
LevelsCount (int)
LevelPct1..10 (double)
Lot1..10 (double)
TP_Percent (double)
PriceTolPts (int)
ModifyTolPts (int)
DeviationPts (int)

Technical Requirements

  • Must be coded in pure MQL5 (no MT4 or conversion).

  • Must use CTrade (Trade/Trade.mqh) and OnTradeTransaction.

  • Fully compatible with Hedge accounts.

  • Must compile with 0 errors and 0 warnings on the latest MT5 build.

  • Handle different symbol digits/points (e.g., XAUUSD, BTCUSD).

  • Must run and optimize properly in "Every tick based on real ticks" mode.

  • Include clear internal logs for:

    • Anchor/re-anchor detection

    • Grid creation/deletion

    • TP updates

    • Reset/Re-arm events


Acceptance Criteria

  1. Compiles cleanly (0 errors/warnings) on MetaEditor 5.

  2. In a visual backtest, the EA must:

    • Place BUY LIMIT grid at the anchor top.

    • When one or more trades hit TP → close all open positions + cancel all pending orders.

    • Re-anchor to the next valid top and rebuild the grid automatically.

    • Not re-anchor while trades are still open.

    • Avoid duplicate pending orders within PriceTolPts .

    • Update global TP properly when average entry changes.

  3. Works consistently on XAUUSD, BTCUSD, and other CFD pairs.


Deliverables

  • One .mq5 file (full source code, well-commented).

  • Short “readme” with:

    • How to attach EA to chart

    • Recommended test settings

    • Suggested parameters for XAUUSD and BTCUSD (H1, 10/20/30/40/55 retracements, lots 0.01–0.03, TP=12%).

  • 30-day bug fix period after delivery (minor corrections included).


Optional (Nice to Have)

  • Option for partial close (close X% of positions at an intermediate TP).

  • CSV export of anchor, TP, and deal data.

  • Backtest cost simulation (spread/commission/slippage).


What to Include in Proposal

  • Links or screenshots of previous MT5 EAs using OnTradeTransaction .

  • Confirmation that all acceptance criteria will be met.

  • Delivery time and final price.


🟢 Notes from client (Wily Machado):
I already have partial working logic, but compilation and event handling keep failing.
The goal is a stable, clean, and testable EA that can run long-term safely with low drawdown and consistent profits.
If you deliver that, I’ll likely hire you again for optimization and advanced modules (partial exits, trailing TP, etc.). 



Répondu

1
Développeur 1
Évaluation
(17)
Projets
21
10%
Arbitrage
4
50% / 50%
En retard
1
5%
Travail
2
Développeur 2
Évaluation
(4)
Projets
4
25%
Arbitrage
1
0% / 0%
En retard
0
Travail
3
Développeur 3
Évaluation
(159)
Projets
284
35%
Arbitrage
18
22% / 56%
En retard
42
15%
Chargé
4
Développeur 4
Évaluation
(14)
Projets
19
11%
Arbitrage
1
0% / 100%
En retard
5
26%
Gratuit
5
Développeur 5
Évaluation
(1)
Projets
3
0%
Arbitrage
0
En retard
0
Gratuit
6
Développeur 6
Évaluation
(305)
Projets
546
35%
Arbitrage
79
32% / 42%
En retard
196
36%
Travail
7
Développeur 7
Évaluation
Projets
0
0%
Arbitrage
1
0% / 100%
En retard
0
Gratuit
8
Développeur 8
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Gratuit
9
Développeur 9
Évaluation
(1)
Projets
2
0%
Arbitrage
1
0% / 100%
En retard
0
Gratuit
Publié : 2 codes
10
Développeur 10
Évaluation
(327)
Projets
392
52%
Arbitrage
20
55% / 15%
En retard
28
7%
Occupé
11
Développeur 11
Évaluation
(16)
Projets
20
0%
Arbitrage
10
0% / 80%
En retard
6
30%
Gratuit
12
Développeur 12
Évaluation
(247)
Projets
253
30%
Arbitrage
0
En retard
3
1%
Gratuit
Publié : 2 codes
13
Développeur 13
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Gratuit
Commandes similaires
Description I need an very low latency MT5 Expert Advisor (EA) developed in MQL5 to automate TradingView alerts into MT5 trades for alerts set up done on trading view. The EA must work on both DEMO and LIVE accounts whichever will be attached to MT5 (XM, IC Markets and similar MT5 brokers) and be suitable for fast 1-minute timeframe scalping.End to End solution. Functional Requirements 1. TradingView Integration
Project Overview I am looking for an experienced MQL5 developer to build a custom, prop-firm-compliant trend-following Expert Advisor (EA) for MetaTrader 5 . This EA will be used on prop firm accounts (e.g., FTMO-style rules), so strict risk control and rule compliance are mandatory . This is NOT a grid, martingale, scalping, or recovery EA. The goal is consistency, rule compliance, and capital preservation , not
I am looking of an Expert Advisor (EA) that has undergone independent validation and demonstrates a capability to successfully navigate prop firm challenges, as well as efficiently manage funded accounts. It is imperative that you provide a comprehensive explanation of the strategy utilized by your EA, along with a demo version that has a 30-day expiration. This will facilitate extensive back testing and forward
Hellow,l hope you are well,l am writing to place an order for a professional trading robot.l am looking for a reliable,well optimized robot that can trade efficiently,manage risk properly and deliver consistent performance in the market,I am particularly interested in a trading robot that uses a proven and transparent strategy,has strong risk management features,works well on common trading platforms,is suitable for
I am looking for an experienced MQL5 developer to build a professional MT5 software (indicator or semi-automated EA) for metals and major forex pairs. 📌 PLATFORM & MARKETS Platform: MetaTrader 5 Instruments: XAUUSD (Gold vs USD) XAGUSD (Silver vs USD) EURUSD GBPUSD USDJPY Trading styles: Scalping Intraday / short-term swing 🎯 MAIN OBJECTIVE I do NOT want an aggressive fully automated robot. I want a
I am seeking an experienced freelance marketing and algorithmic trading specialist to develop a user-friendly automated trading bot for the Pocket Option platform. The system should feature a simple and secure interface that allows direct login using my existing credentials. The bot will be designed to operate exclusively on multiple OTC currency pairs (a minimum of 10, such as EUR/USD OTC, GBP/JPY OTC, and similar
The robot will take buy trades when the 2 ema cross over the 10 ema and price has closed above the 50 ema. The take profit and stop loss can be set as an optional level by the user. The robot will take sell trades when the 2 ema cross under the 10 ema and price has closed under the 50 ema. The take profit and stop loss can be set as an optional level by the user. The entry timeframe will be 15 minutes, but it could
GoldTrade EA 30 - 60 USD
Hi, I am looking for someone who has already developed a high-performance Gold EA that can outperform the one shown in my screenshot. If you have such an EA, please apply for this job. Please describe how the EA works (for example, whether it uses a grid system) and provide backtest results along with the set files. If the EA meets my expectations, you can make the necessary adjustments and I will use it as my own
Create simple EA 30 - 60 USD
Start BUY:- when i click start BUY button new panel should open which should contain bellow points:- Trigger Price Time frame Cross/Close RR ration Trailing Stop ratio Maximum Trade count Risk (percentage or cash) (Option to Increase risk when SL hit) Remove Trigger (True/False ) I will explain above point one by one here bellow •Trigger price :- here we enter price at which when market cross or
I want to check if this indicator is repainting or not Whick mean the results of back testing is legit or not if anyone can help me to review it kindly to well to contact me i will be happy to work and go on long term work with anyone thanks

Informations sur le projet

Budget
50+ USD