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

İş tamamlandı

Tamamlanma süresi: 12 gün
Müşteri tarafından geri bildirim
approved! thank you Rodrigue
Geliştirici tarafından geri bildirim
Happy to work with you

İş Gereklilikleri

💼 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.). 



Yanıtlandı

1
Geliştirici 1
Derecelendirme
(18)
Projeler
22
9%
Arabuluculuk
6
33% / 50%
Süresi dolmuş
1
5%
Çalışıyor
2
Geliştirici 2
Derecelendirme
(4)
Projeler
5
20%
Arabuluculuk
1
100% / 0%
Süresi dolmuş
0
Serbest
3
Geliştirici 3
Derecelendirme
(160)
Projeler
285
35%
Arabuluculuk
18
22% / 61%
Süresi dolmuş
42
15%
Yüklendi
4
Geliştirici 4
Derecelendirme
(14)
Projeler
19
11%
Arabuluculuk
1
0% / 100%
Süresi dolmuş
5
26%
Serbest
5
Geliştirici 5
Derecelendirme
(1)
Projeler
3
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
6
Geliştirici 6
Derecelendirme
(308)
Projeler
553
35%
Arabuluculuk
79
32% / 42%
Süresi dolmuş
200
36%
Yüklendi
7
Geliştirici 7
Derecelendirme
Projeler
0
0%
Arabuluculuk
1
0% / 100%
Süresi dolmuş
0
Serbest
8
Geliştirici 8
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
9
Geliştirici 9
Derecelendirme
(1)
Projeler
2
0%
Arabuluculuk
1
0% / 100%
Süresi dolmuş
0
Serbest
Yayınlandı: 2 kod
10
Geliştirici 10
Derecelendirme
(350)
Projeler
421
54%
Arabuluculuk
20
55% / 15%
Süresi dolmuş
29
7%
Çalışıyor
11
Geliştirici 11
Derecelendirme
(16)
Projeler
20
0%
Arabuluculuk
10
0% / 80%
Süresi dolmuş
6
30%
Serbest
12
Geliştirici 12
Derecelendirme
(252)
Projeler
258
30%
Arabuluculuk
0
Süresi dolmuş
3
1%
Serbest
Yayınlandı: 2 kod
13
Geliştirici 13
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
Benzer siparişler
Hello, I'm looking to find out the cost of creating a mobile trading robot. I've tried to describe it as thoroughly as possible in the following document. I look forward to your response. I'd like to know the costs, delivery time, and how you plan to implement it before making a decision
I have an existing MT5 Expert Advisor (“E-Core”). I need an experienced MQL5 developer to integrate a structured risk management upgrade and a higher timeframe trend filter into the current code. Two files will be provided: 1️⃣ E-Core Source Code (Current Version) 2️⃣ Update Instructions File (contains exact inputs, functions, and logic to integrate) The developer must: Integrate the update logic
DO NOT RESPOND TO WORK WITH ANY AI. ( I CAN ALSO DO THAT ) NEED REAL DEVELOPING SKILL Hedge Add-On Rules for Existing EA Core Idea SL becomes hypothetical (virtual) for the initial basket and for the hedge basket . When price hits the virtual SL level , EA does not close the losing trades. Instead, EA opens one hedge basket in the opposite direction. Original basket direction Hedge basket direction (opposite) Inputs
Billionflow 30 - 100 USD
Trading specifications: Indicators: Bollinger band ( Period 40, Deviation 1 apply to close) Moving Average (Exponential ) Period 17 applied to high Moving Average ( Exponential ) Period 17 applied to low But Signal enter a buy trade when prices crosses the lower band of the bollinger band up and also crosses the moving average channel of high and low the reverse is true for sell signal
Hello, I am a user of the "BUY STOP SELL STOP V6" trading bot, which is an advanced Grid System bot. The bot is primarily designed for Gold (XAUUSD), but I want it to work on all currency pairs. "The bot contains a privacy/protection code that prevents it from running on other accounts or being modified on any platform, as it has a client account number lock mechanism" --- Bot Description & Current Settings Bot Type
I am looking for a highly experienced Pine Script v5 developer to build a professional, non repaint price action indicator for TradingView. or a ready made one so i can purchase. This is a structured two phase project. The goal is to create a clean, intelligent price action tool that works for both fast intraday trading and swing trading. Only apply if you have strong Pine experience and understand liquidity
Hello, I’m looking for an experienced MQL4/MQL5 developer to work with me on an ongoing basis. My clients request services such as: Converting TradingView Pine Script indicators/strategies into MT4 or MT5 Expert Advisors Converting MT4 EAs to MT5 (and MT5 to MT4) Compiling and fixing existing MQL4 / MQL5 EA code Adding simple features like alerts, SL/TP, lot size, and basic money management This job is for
I am looking someone to create an EA based on my MACD Histo indicator / strategy from Pinescript. I will send it to you for you to replicate. The EA shall have: - Divergence length in bars, min and max values. - Pivot Logic - Entry on close of divergence confirmation bar. - Dynamic lot size dependent on SL/TP, in monetary value. - SL / TP in percent away from entry, separate values for long and short. - Time, day and
Hello, I have a breakout EA with reversal logic. I own the full source code for both MT4 and MT5 versions. I need the modifications implemented for both MT4 and MT5 versions. I need several modifications: – Multiple reversals with configurable parameters – Breakeven functionality – Entry only after candle close beyond range + offset – Time-based activation – Alternative offset calculation logic – Automatic close at
simple automated trading system with adaptive risk management and trend-based execution. The EA manages trades with dynamic position handling and built-in stability filters. Designed for single-position trading and disciplined execution 30 usd budget

Proje bilgisi

Bütçe
50+ USD