Modular - Hedge Grid EA

MQL5 Experts

Specification

1. Overview

This EA implements a modular, hedged grid trading strategy for Forex and Metals. It can place buy/sell stop or limit orders based on user-defined parameters such as grid range, spacing, lot size sequences, and directional preferences.

Designed for multi-purpose use, this EA supports:

  • Hedged grid logic with full auto-basket closure
  • One-sided grid strategies with breakeven or trailing stop exits
  • Virtual SL management
  • Visual, interactive UI for per-symbol control
  • Multiple chart and watchlist integration
  • High customizability for traders of different styles


2. Grid Placement Configuration

2.1 Grid Range & Spacing

User can define:

  • Start Price
  • End Price
  • Total Number of Orders
  • Grid Spacing Method:

Grid Spacing Methods:

  • Fixed: Constant pip or price gap (e.g., every 10 pips)
  • Arithmetic: Gradually increasing spacing (e.g., +10, +15, +20 pips)
  • Geometric: Spacing increases by a factor (e.g., 10, 20, 40 pips)
  • Divided Range:
    Formula: (Start Price - End Price) / (Number of Orders - 1)
    Example: Start = 1.6900, End = 1.6800, Orders = 5
    Spacing = (1.6900 - 1.6800) / (5 - 1) = 0.0025 (25 pips)
  • Fibonacci Levels: Spacing follows Fibonacci intervals
  • Manual: User defines each grid price level manually


2.2 Order Types to Place

Users can select any combination of the following:

  • ✅ Buy Stop Orders
  • ✅ Buy Limit Orders
  • ✅ Sell Stop Orders
  • ✅ Sell Limit Orders

This enables:

  • Hedged setups (e.g., Buy Stop + Sell Limit)
  • Reversal setups (e.g., Buy Limits only)
  • Breakout setups (e.g., Sell Stops only)
  • Partial hedging (e.g., Buy Limit + Sell Stop)


2.3 Trend Direction Buttons

Two core buttons define default structure:

  • Buy Grid = Uptrend (places Buy Stops and Sell Limits)
  • Sell Grid = Downtrend (places Sell Stops and Buy Limits)

However, user can override order types manually via checkboxes.


2.4 Lot Size Sequences

User can input custom sequences for lot sizing:

Supported Methods:

  • Fixed: e.g., [0.1, 0.1, 0.1, 0.1]
  • Progressive: e.g., [0.1, 0.2, 0.3, 0.4]
  • Fibonacci: e.g., [0.1, 0.1, 0.2, 0.3, 0.5]
  • Custom: Any array input accepted

Lot Sequence Direction:

Each side (Buy and Sell) can apply:

  • Normal: Use input sequence as-is
  • Reversed: Apply in reverse order

Example:

Input Lot Sequence: [0.1, 0.1, 0.2, 0.3, 0.5]

  • Buy Limits → Normal → [0.1, 0.1, 0.2, 0.3, 0.5]
  • Sell Stops → Reversed → [0.5, 0.3, 0.2, 0.1, 0.1]


3. Execution Workflow Example

Example Setup:

  • Start: 1.6900
  • End: 1.6800
  • Orders: 5
  • Lot Sequence: [0.1, 0.1, 0.2, 0.3, 0.5]
  • Trend: Downtrend (via Sell Grid button)
  • Selected Order Types: ✅ Sell Stop + ✅ Buy Limit
  • Spacing: (1.6900 - 1.6800) / 4 = 0.0025

Order Execution:

  • Sell Stops (reversed lot order):
    • Prices: 1.6900, 1.6875, 1.6850, 1.6825, 1.6800
    • Lots: [0.5, 0.3, 0.2, 0.1, 0.1]
  • Buy Limits (original lot order):
    • Prices: Same as above
    • Lots: [0.1, 0.1, 0.2, 0.3, 0.5]


4. Basket Closure Logic

4.1 In Hedged Mode (Buy + Sell Orders)

  • Basket automatically closes when all selected grid orders are filled
  • No TP required — profit is locked via hedging
  • Virtual SL can still be applied as a safety net

4.2 In Single-Sided Mode (One Order Type Only)

  • EA activates breakeven and/or trailing stop logic
  • Basket closed when:
    • Breakeven triggered
    • Trailing Stop hit
    • Manual close
  • No hedging, so SL/TP logic is essential

4.3 Manual Option

  • Basket can be closed manually at any time using "Close Basket" button


5. Breakeven & Trailing Stop Logic (Single-Sided Grids Only)

5.1 Breakeven

  • Activates after price moves in favor by X points
  • Moves stop loss to entry + buffer

User Inputs:

  • Activation distance (e.g., 30 pips)
  • Breakeven buffer (e.g., +2 pips)


5.2 Trailing Stop Types

a) Fixed Point Trail

  • Trail SL by fixed value after reaching profit threshold

b) ATR-Based Trail

  • Trail distance = ATR(n) × Multiplier
  • Example: ATR(14) × 1.5

c) Swing-Based Trail

  • SL placed below/above recent swing highs/lows
  • Swing lookback period is configurable

User Inputs:

  • Activation Profit (e.g., 20 pips)
  • Trail Type (Fixed / ATR / Swing)
  • Trail Distance or Lookback
  • Optional SL buffer


6. Virtual Stop Loss

  • All SL is virtual — not visible to broker
  • Basket is closed if floating loss exceeds threshold
  • Applies in both hedged and single-sided modes


7. UI Panel (Per Symbol)

UI Displays:

  • Active grids
  • Grid direction
  • Order count: Filled / Pending
  • Lot totals (Buy/Sell)
  • Average breakeven prices
  • Real-time locked PNL
  • Commission per basket
  • Estimated margin usage

UI Inputs:

  • Start / End price
  • Number of orders
  • Lot size sequence
  • Lot direction (Normal / Reversed)
  • Select Order Types (checkboxes)
  • Select Grid Spacing Type
  • Trailing / Breakeven settings (if single-sided)
  • Grid Preview on Chart (price levels, margin usage)
  • Confirm button for order placement

UI Buttons:

  • 🔘 Create Buy Grid (Uptrend logic)
  • 🔘 Create Sell Grid (Downtrend logic)
  • ❌ Close Basket


8. Multi-Symbol & Auto-Attach

  • EA automatically applies settings across all symbols in watchlist
  • Once configured, settings are remembered per chart
  • Each symbol runs independently with its own grid, orders, and UI


9. Margin Estimation

  • EA estimates required margin:
    • Before order placement
    • As orders are filled
  • Factors:
    • Symbol leverage
    • Lot sizes
    • Contract size
    • Entry prices


10. Safety & Error Handling

  • Max number of orders (user-defined)
  • Max lot size (user-defined)
  • Re-attempts failed order placements up to 3 times
  • Logs all errors (invalid levels, insufficient margin, etc.)
  • Alerts user on invalid inputs or conditions


11. Developer Notes

  • Grid logic must support:
    • Float pricing
    • Custom sequences and spacing
    • Opposite lot direction mirroring
  • SL/TP must be fully virtual
  • UI should be responsive and update live
  • Support trailing stop logic per type (ATR, swing, fixed)
  • Margin preview required before order confirmation
  • Must support fast switching between symbols
  • Modular order type handling


12. Deliverables

  • ✅ Complete MQL5 EA (compiled and source code)
  • ✅ Per-symbol UI with live display and control
  • ✅ Clean, commented codebase
  • ✅ User Manual (PDF or markdown)
  • ✅ Backtest and forward test logs
  • Optional

Responded

1
Developer 1
Rating
(230)
Projects
286
27%
Arbitration
14
50% / 36%
Overdue
9
3%
Loaded
2
Developer 2
Rating
(36)
Projects
38
11%
Arbitration
2
50% / 50%
Overdue
2
5%
Working
3
Developer 3
Rating
Projects
1
0%
Arbitration
3
33% / 33%
Overdue
0
Working
4
Developer 4
Rating
(4)
Projects
2
0%
Arbitration
1
0% / 0%
Overdue
1
50%
Working
5
Developer 5
Rating
(75)
Projects
123
43%
Arbitration
12
33% / 50%
Overdue
17
14%
Free
6
Developer 6
Rating
(7)
Projects
8
13%
Arbitration
5
40% / 20%
Overdue
0
Free
7
Developer 7
Rating
(5)
Projects
5
20%
Arbitration
0
Overdue
0
Working
8
Developer 8
Rating
(11)
Projects
11
18%
Arbitration
1
0% / 0%
Overdue
1
9%
Free
9
Developer 9
Rating
(462)
Projects
907
76%
Arbitration
25
16% / 68%
Overdue
99
11%
Free
Published: 1 article, 6 codes
10
Developer 10
Rating
(6)
Projects
6
17%
Arbitration
2
0% / 0%
Overdue
1
17%
Loaded
11
Developer 11
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
12
Developer 12
Rating
(1)
Projects
1
0%
Arbitration
0
Overdue
0
Free
13
Developer 13
Rating
(164)
Projects
212
20%
Arbitration
18
44% / 17%
Overdue
0
Working
14
Developer 14
Rating
(8)
Projects
12
0%
Arbitration
22
0% / 77%
Overdue
4
33%
Free
15
Developer 15
Rating
(1)
Projects
1
0%
Arbitration
2
0% / 0%
Overdue
0
Working
16
Developer 16
Rating
(279)
Projects
330
51%
Arbitration
12
42% / 0%
Overdue
18
5%
Loaded
17
Developer 17
Rating
(7)
Projects
11
18%
Arbitration
6
17% / 0%
Overdue
3
27%
Working
18
Developer 18
Rating
(84)
Projects
115
70%
Arbitration
5
80% / 0%
Overdue
11
10%
Free
19
Developer 19
Rating
(291)
Projects
521
36%
Arbitration
62
34% / 35%
Overdue
187
36%
Loaded
20
Developer 20
Rating
(270)
Projects
550
49%
Arbitration
56
39% / 36%
Overdue
227
41%
Working
21
Developer 21
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
22
Developer 22
Rating
(1)
Projects
1
100%
Arbitration
1
0% / 0%
Overdue
0
Working
23
Developer 23
Rating
(51)
Projects
69
35%
Arbitration
1
100% / 0%
Overdue
0
Free
24
Developer 24
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
Similar orders
I am looking for an experience MQL4 developer for making a profitable prop firm compatible MT4 gold scalper EA on a 5 Minute time frame. The EA should have a win rate of not less than 90% on back testing. The EA should be able to pass all prop firm challenges like Funded Next, FTMO, Funding Pips within 1-2 weeks. The EA should also work on live funded account. Any strategy can be used to develop the EA. Proper risk
I’m looking for a profitable Expert Advisor (EA) — the real beast that can deliver strong results on MT4/MT5. If you have a proven EA with good performance and risk management, kindly reach out with details and results
Description: I'm looking for an experienced MQL5 developer to build a fully automated Expert Advisor (EA) for trading the MNQ100 Micro E-mini Nasdaq futures on MetaTrader 5 , specifically tailored for use on a funded prop firm account . The EA will be running unattended, so it must have reliable built-in risk management and strict protections to comply with typical prop firm rules (such as daily loss limits, max
Modify my MT5 EA 30 - 40 USD
I am looking for an MQL5 programmer who can modify and customize my personal MT5 EA. There is problem in placing stop loss but still the EA is profitable on back testing. I also want to add news filter and prop firm compatible. The details will be shared to the developer personally
Hi, I am looking for readymade EA/a developer who can build it one for me. Feel free to contact me if you can fulfill my requirement. But be sure my a developer must have capability to develop complex EA with robust architecture. Especially on sophisticated trading methodology i.e. ICT/SMC etc
Please build me an EA tha can do the following: Normally I when executed buy (0.01)trade, I place sell (0.03) stop order for in case I predicted wrong, and when this sell is triggered, I place buy (0.07) stop on the initial buy, and the circle go on until I Tp is hit, all these trades I set TP and SL on them and they correspond, for sells will have same TP and Same SL, and all buys triggered after initial will have
I’m looking to hire an experienced MQL5 developer to help me build a custom Expert Advisor (EA) that combines three trading strategies into one smart, modular EA: ✅ Price Action-Based Entries ✅ Trendline Continuation or Breakout Recognition ✅ Structure Breakout & Retest Entries 📈 EA Concept Overview: The EA will: Analyze market structure (HH, HL, LH, LL) Auto-draw or simulate trendlines using swing highs/lows Detect
I want to generate analysis that gives me trades based on these examples from the developer youtube side Some extra info how i see refinement of analysis Ultimate Top Down Analysis Strategy (Step by Step) https://youtu.be/GKN-iVjJpyA?si=rJpX8YWzzlY6N1Pb some inducement entry model https://youtu.be/86wSTni7B14?si=4By5LiHMWk11p0Dr This entry model will change how you trade…
Hi, I have an EA, which places limit order by reading the text file. EURJPY, SELL, 171.74263, 171.80196, 29/08/2025, 16:15, 29/08/2025, 17:15, 0.05932, 171.59432, 1.24 The above one is the format of the text file which the EA reads/ BIAS PRICE SL PRICE CREATE DATE CREATE TIME EXPIRY DATE EXPIRY TIME SL PIPS TP LOT SIZE Now, I am in need of another variable named: Delete Price This will be the next one in the same
Hello, I am looking for a highly skilled MQL5 developer to backtest and optimize an existing Expert Advisor (EA) for stable and consistent results on XAUUSD (Gold), M5 timeframe . Project Scope: Run in-depth backtests using reliable historical data Perform advanced parameter optimization (risk settings, SL/TP, trailing, lot size, etc.) Ensure stable performance suitable for 24/5 live trading Trading Targets: Profit

Project information

Budget
50 - 150 USD
Deadline
to 2 day(s)

Customer

Placed orders1
Arbitrage count0