Build an MT5 Expert Advisor: Grid Martingale with Dual Cycles & Hedge

Работа завершена

Время выполнения 9 дней
Отзыв от заказчика
This developer was a dream! He coded my EA perfectly, was incredibly responsive, and patiently answered all my questions. Felt completely supported throughout the entire process.
Отзыв от исполнителя
Amazing Customer

Техническое задание

EA Concept: Grid Martingale with Hedge

This EA for MT5 (MQL5) runs a continuous price-level grid system with independent buy and sell cycles.
It uses manual martingale lot sizes, a hidden profit target, and a Full hedge when price moves too far from the anchor or reaches max negative equity.

No indicators or signals — it starts trading immediately on launch.


🎯 Core Behavior

  • Rule # 1: Always has one buy and one sell base trade active on each grid.

  • Rule # 2:  As price moves in one direction, the with-trend side keeps taking hidden TPs at next grid and reopening.

  • Rule # 3:  The against-trend side builds a martingale basket using predefined lot steps.
  • Rule # 4:  Once the basket’s total floating profit reaches a set cash or pip target, it closes all trades on that side together.
  • Rule # 5:  If price keeps trending far enough (past a defined number of grids or equity), the EA opens a full hedge to flatten exposure, then resets the whole cycle.

⚙️ Key Inputs

Input Description
GridSizePips = 30 Distance between grid levels
LotSizes = "0.01;0.02;0.03;0.06;0.09;0.18;0.33;0.57;0.75" Manual list of lot sizes per leg; last one repeats if needed
Profit$ = 10 Hidden profit target in account currency (for martingale baskets)
ProfitPips = 5 Hidden pip target from weighted average price
HedgeLevel = 10
Number of grids from anchor before hedge trigger
Max Equity = 1000  Maximum Negative Equity from anchor will trigger hedge 
MaxSpreadPips = 1 Spread filter – skip new trades if exceeded
MagicNumber = 1995 Default magic number, user can change
SlippagePips = 1 Max slippage allowed
AllowHedgeReset = true Enables/disables the hedge reset logic
AllowNewCycle = true Master on/off switch for opening new cycles after hedge
CommentTag = "GridMartingaleEA" Order comment prefix

🧩 Definitions

  • Pip: 0.0001 for standard pairs, 0.01 for JPY pairs.

  • Convert grids to points automatically.

  • Spread check: If spread > MaxSpreadPips, skip new entries but continue managing open trades.


🔁 State Model (per symbol)

The EA tracks:

  • anchor_price : Starting point for the current grid cycle.

  • grid_index : Current grid level relative to anchor.

  • Lists of open buy and sell trades (tickets, lots, prices, grid levels).

  • lot_step_index_buy/sell : Which lot size to use next.

  • hedge_triggered : Flag for when hedge is active.

  • cycle_id : Used in comments for order tracking and recovery after restart.


🧠 Trading Logic Summary

  1. On startup (Grid 0)

    • Open one Buy and one Sell (first lot each).

    • No visible SL/TP — handled internally.

  2. When price moves one grid up:

    • The Buy side (with trend) closes its hidden TP and reopens a new base Buy at the new level.

    • The Sell side adds a new leg (next lot size) at the new grid level.

  3. When price moves one grid down:

    • Mirror behavior — Sell side takes profit and reopens; Buy side adds new leg.

  4. Take Profit rules:

    • Base trades close individually on hidden TP (small cash or pip target).

    • Martingale baskets close all legs together when combined profit hits the target (cash or pips).

  5. Hedge Reset:

    • If price moves HedgeLevel grids away from anchor, EA opens a hedge position equal to total opposite exposure.

    • After that, all orders stay open for manual closure.

    • EA resets cycle (new anchor = current price, clear arrays, start over).

  6. Limits:

    • Max one buy and one sell per grid level.

    • If spread too high, skip entries.

    • Continue managing existing trades even when new entries are paused.


🧾 Technical Notes for Implementation

  • Use SymbolInfoInteger to get pip size/digits.

  • Parse LotSizes string into a numeric array; repeat last value if more legs are needed.

  • Respect broker min/max lot and margin.

  • Handle ECN brokers (no SL/TP on order send).

  • Retry on REQUOTE or PRICE_CHANGED .

  • Identify each order by magic number + cycle_id + grid + side + leg in comment.

  • Manage logic on every tick (or timer for quiet markets).


🧱 Example Flow

  1. Grid 0: Buy 0.01, Sell 0.01

  2. Price up 1 grid → Buy hits hidden TP → new Buy 0.01; Sell adds 0.02 leg

  3. Price up another grid → Buy TP again → new Buy 0.01; Sell adds 0.03 leg

  4. Price drops back → Buy side now accumulates legs; Sell side resumes its base TP behavior.

  5. If Sell basket profit ≥ $10 (or 5 net pips), close all Sell legs; reset side.


🧩 Summary in One Line

Always one buy + one sell active, build martingale legs only on the losing side, close baskets at hidden TP, and if price drifts too far — hedge Full and restart EA.


On-Chart Summary Display

Add an on-chart status summary that updates automatically while the EA is running.
The summary should display key live metrics for both Buy and Sell sides in a compact, readable format at the top-left corner of the chart.

Display format example:

Grid Martingale EA Status Summary Buy Side: Neutral Sell Side: Martingale Martingale Trades Open: 5 Total Martingale Lots: 1.70 Floating P/L: -215 USD Anchor Price: 1.08420 Current Grid Index: +3 Hedge Trigger: OFF Cycle ID: 24 Spread: 0.8 pips

Behavior requirements:

  • Refresh automatically on every tick (or once per second).

  • Always show the current EA state clearly — even if no trades are open.

  • If either side (Buy or Sell) is running a martingale sequence, label it as “Martingale”; otherwise, “Neutral”.

  • Floating profit/loss should show the combined unrealized P/L of the active martingale basket in account currency.

  • Use consistent decimal precision (2 for lots, 1 for pips, 2 for USD).

  • Optional: color-code values for clarity (e.g., green for profit, red for loss).

Placement and style:

  • Top-Right or Left corner of the chart.

  • Clear, easy-to-read font.

  • Simple layout, no external UI libraries needed.

  • Should not interfere with order execution or EA logic.


Откликнулись

1
Разработчик 1
Оценка
(18)
Проекты
22
9%
Арбитраж
6
33% / 50%
Просрочено
1
5%
Работает
2
Разработчик 2
Оценка
(504)
Проекты
971
74%
Арбитраж
27
19% / 67%
Просрочено
100
10%
Загружен
Опубликовал: 1 статью, 6 примеров
3
Разработчик 3
Оценка
(253)
Проекты
259
30%
Арбитраж
0
Просрочено
3
1%
Свободен
Опубликовал: 2 примера
4
Разработчик 4
Оценка
(85)
Проекты
168
44%
Арбитраж
3
67% / 0%
Просрочено
5
3%
Работает
Опубликовал: 1 пример
5
Разработчик 5
Оценка
(6)
Проекты
5
0%
Арбитраж
2
50% / 50%
Просрочено
2
40%
Свободен
6
Разработчик 6
Оценка
(308)
Проекты
553
35%
Арбитраж
79
32% / 42%
Просрочено
200
36%
Загружен
7
Разработчик 7
Оценка
(14)
Проекты
19
11%
Арбитраж
1
0% / 100%
Просрочено
5
26%
Свободен
8
Разработчик 8
Оценка
(24)
Проекты
30
13%
Арбитраж
12
0% / 75%
Просрочено
8
27%
Свободен
9
Разработчик 9
Оценка
(154)
Проекты
192
58%
Арбитраж
10
80% / 0%
Просрочено
0
Работает
Опубликовал: 1 пример
10
Разработчик 10
Оценка
(6)
Проекты
6
17%
Арбитраж
1
0% / 0%
Просрочено
0
Работает
11
Разработчик 11
Оценка
(1)
Проекты
1
0%
Арбитраж
0
Просрочено
0
Свободен
12
Разработчик 12
Оценка
(1)
Проекты
2
0%
Арбитраж
1
0% / 100%
Просрочено
0
Свободен
Опубликовал: 2 примера
13
Разработчик 13
Оценка
(77)
Проекты
243
74%
Арбитраж
7
100% / 0%
Просрочено
1
0%
Свободен
Опубликовал: 1 статью
Похожие заказы
I am looking for a professional MQL5 developer to build a MetaTrader 5 Expert Advisor from scratch. The EA will be called LadyKiller EA. It must trade only the following instruments: • XAUUSD (Gold) • US30 / Dow Jones Index Requirements: • Strong and reliable buy and sell entry logic • Stop Loss and Take Profit system • Risk management (lot size control) • Maximum trades protection • Drawdown protection • Trend
I need an mql5 EA which can be used with 100$ capital very low drawdown The EA should be high frequency trading special for XAUUSD and btcusd or binary options but also the EA should be testable via strategy tester and demo test for five days is needed NO SELECTION CAN BE DONE WITHOUT TESTING when applying make sure you send the backtester results with demo EA testable via strategy tester
I currently have a powerful and well-structured Expert Advisor available on the MT5 platform. This EA is designed with: ✅ Advanced entry and exit logic ✅ Smart risk management system ✅ Automatic lot sizing option ✅ Break-even and trailing stop protection ✅ Spread and session filters ✅ Drawdown control features ✅ Optimized for XAUUSD and scalping strategies ✅ Suitable for prop firm challenges like FTMO It is built for
Do you need a profitable and well-structured trading strategy converted into a fully automated Expert Advisor on the MT5 platform? I specialize in developing advanced, high-performance EAs with: ✅ Smart entry & exit logic ✅ Risk-based lot size calculation ✅ Break-even & trailing stop system ✅ Spread & session filters ✅ Daily drawdown protection ✅ Prop firm (FTMO-style) risk compliance ✅ Fully automated trade
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 am offering a ready-to-use trading system that connects MetaTrader 4 signals with automated trading on Polymarket. The system is already fully developed and working. What the system does: The bot copies signals from a custom MT4 indicator and executes trades automatically on Polymarket prediction markets. How it works: A custom MT4 indicator generates BUY or SELL signals using buffers. When a signal appears, it is
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
Looking to purchase a Good forex or gold/ BTC trading EA and it's source code. Must be compatible with low budget like less than $500 accounts, Must need no manual intervention and run fully automated. If you are interested in selling me the source code, please share the Read only account access where the EA has already been running on, so i can check past performance and get an idea on how it works or runs. Dont

Информация о проекте

Бюджет
30+ USD
Сроки выполнения
до 2 дн.