MT5 Portfolio Hedge Supervisor EA (Gold Grid Protection Bot)

MQL5 전문가

작업 종료됨

실행 시간 2 일
피고용인의 피드백
Thanks for the project. Looking forward to the next one!

명시

I need an MT5 Expert Advisor (MQL5) that works as a portfolio-level hedge supervisor for my gold grid EAs.

Key idea:

The EA will NOT open normal trading positions. It will only:

– Monitor account margin level.
– When margin level drops below a defined threshold (for example 250%), open a hedge position in the opposite direction of my net exposure.
– Use the hedge profit to “pay off” the oldest losing trade.
– If the market reverses and my grids recover, close the hedge at break-even (hedge loss offset by grid profit) and let the grids continue normally.

This EA will run on one chart only and manage risk for the whole portfolio (multiple XAU pairs and multiple magic numbers).

Platform and account

– MetaTrader 5
– Hedging account (not netting)
– Symbols mainly XAU pairs (XAUUSD, XAUJPY, XAUEUR etc.)
– Multiple grid EAs already running, each with its own magic number

Logic – high level

  1. The EA runs on one chart (any symbol).
  2. On every tick it reads:
    – Balance, Equity, Margin, MarginLevel%.
  3. It builds a list of “protected trades”:
    – Only trades whose symbol is in a user-defined list (e.g. XAUUSD,XAUJPY,XAUEUR).
    – Only trades whose magic is in a user-defined list (e.g. 1001,1002,1003).
    – It must exclude its own hedge trades (separate hedge magic number).

Hedge activation (when there is no active hedge)

– If MarginLevel < MarginLevel_Trigger (for example 250%) and there is at least one losing trade in the protected set:

  1. Find the “oldest losing trade” (Profit < 0, earliest open time).
  2. Decide the hedge symbol:
    – Either the same symbol as that oldest losing trade, or a master symbol such as XAUUSD (user input).
  3. Calculate exposure:
    – Option 1 (BY_NET_EXPOSURE): sum all buy lots minus sum all sell lots of protected trades and take the absolute value.
    – Option 2 (BY_OLDEST_TRADE): use only the lot size of the oldest losing trade.
  4. Hedge lot size:
    – TargetHedgeLot = exposure_lots × HedgeFactor (e.g. 0.30).
    – Calculate MaxLotByMargin based on FreeMargin, Margin per lot, and a SafetyFactor (e.g. 0.7 so we do not use all free margin).
    – HedgeLot = min(TargetHedgeLot, MaxLotByMargin, MaxHedgeLot).
    – If HedgeLot < MinHedgeLot (e.g. 0.01), then do not open a hedge.
  5. Hedge direction:
    – Always opposite to the main exposure (or opposite to the oldest losing trade if using that mode).
  6. Open one market hedge position with a separate hedge magic number.
  7. Only one hedge position can exist at any time.

Hedge management (when a hedge is active)

There are two main behaviours:

A) Recoup oldest loser (trend continues against the grids)

– Rebuild the protected trades list.
– Find all losing trades (Profit < 0). If none exist, skip recoup and go to neutralisation logic.
– Select the oldest losing trade.
– Let:
– hedge_profit = profit of the hedge (money, can be positive or negative).
– oldest_profit = profit of the oldest losing trade (negative).
– Recoup rule:
– If hedge_profit + oldest_profit ≥ Recoup_Threshold (usually 0):
– Close the hedge position.
– Close that oldest losing trade.
– Reset internal state (no active hedge).
– Respect a cool-down time between actions (e.g. 60 seconds) so the EA does not over-trade.

Result: the hedge has effectively “paid for” the oldest loser, reducing grid exposure and improving margin.

B) Neutralise hedge (market reverses in favour of the grids)

– Calculate total_grid_profit = sum of Profit for all protected trades (can be overall positive when grids are recovering).
– Optionally require MarginLevel to be above a buffer (e.g. Neutralise_Margin_Buffer = 260) to avoid neutralising too early.
– Neutralisation rule:
– If hedge_profit + total_grid_profit ≥ Neutralise_Threshold (usually 0):
– Close the hedge position only.
– Do NOT close any grid trades.
– Reset internal state.

Result: the hedge is removed at or near break-even (its loss is offset by the grid profit), and the grid trades are left to reach their normal take-profit.

C) Optional hedge stop-loss

– If hedge_profit ≤ -Max_Hedge_Loss (if this input is > 0), close the hedge as an emergency stop, then reset state.

Cooldown and stability

– The EA must use a minimum time between actions (SecondsBetweenActions) to avoid opening or closing multiple trades too fast during spikes.
– It must handle cases where:
– The user manually closes trades or the hedge.
– The broker rejects an order (log the error and continue gracefully).

Inputs (example list)

– MarginLevel_Trigger (double, e.g. 250.0).
– Neutralise_Margin_Buffer (double, e.g. 260.0 or 0 to disable).
– Include_By_Symbol (string, comma separated).
– Include_By_Magic (string, comma separated).
– Hedge_Sizing_Mode (enum: BY_NET_EXPOSURE or BY_OLDEST_TRADE).
– HedgeFactor (double, e.g. 0.30).
– MaxHedgeLot (double).
– MinHedgeLot (double).
– Hedge_Symbol_Mode (enum: SAME_SYMBOL or MASTER_SYMBOL).
– Master_Hedge_Symbol (string, e.g. XAUUSD).
– SafetyFactor (double, e.g. 0.7).
– Max_Hedge_Loss (double, 0 = disabled).
– SecondsBetweenActions (integer, e.g. 60).
– Recoup_Threshold (double, usually 0.00).
– Neutralise_Threshold (double, usually 0.00).
– Hedge magic number (integer, separate from all grid EAs).
– Enable_Logging (bool).

Requirements for the code

– MQL5, clean and well commented.
– No DLLs.
– Must work in the MT5 Strategy Tester and on live trading.
– Use standard CTrade / trade classes and proper error handling.
– Must correctly support hedging accounts.
– Should be efficient enough to run on every tick with multiple symbols and positions.

Deliverables

– Source code (.mq5) and compiled file (.ex5).
– Brief note explaining how to set:
– Margin trigger
– HedgeFactor
– Symbols list
– Magic numbers
– Optional: basic Strategy Tester file or screenshots to prove the EA compiles and runs.

Please only apply if you have experience:

– Coding portfolio-level EAs that manage multiple symbols and magic numbers.
– Working with margin calculations and hedge logic.
– Working with gold (XAU) and high-volatility instruments is a plus.

–––––––––––––––––––––
SHORT “MUST-HAVE” LIST (OPTIONAL)
–––––––––––––––––––––

You can paste this either at the top or in the “Requirements” field:

– MT5 EA (MQL5), hedging account, no DLLs.
– One EA on one chart, monitoring margin level for whole account.
– Triggers when MarginLevel < 250%.
– Opens one hedge position (partial lot size, based on exposure and free margin).
– Uses hedge profit to close oldest losing trade at break-even (close hedge + that trade together).
– If market reverses and grids recover, closes hedge at break-even (hedge loss offset by grid profit), leaving grid trades open.
– Works across multiple XAU symbols and multiple magic numbers.
– Clean, robust code with comments and error handling.

If you want, I can also help you write a short first message to the devs once you start getting proposals (for example, how to check they actually understand the logic).


파일:

응답함

1
개발자 1
등급
(393)
프로젝트
549
40%
중재
30
57% / 3%
기한 초과
57
10%
작업중
게재됨: 11 코드
2
개발자 2
등급
(13)
프로젝트
20
40%
중재
3
0% / 67%
기한 초과
3
15%
무료
3
개발자 3
등급
(15)
프로젝트
19
16%
중재
5
40% / 40%
기한 초과
0
무료
4
개발자 4
등급
(509)
프로젝트
977
74%
중재
27
19% / 67%
기한 초과
101
10%
무료
게재됨: 1 기고글, 6 코드
5
개발자 5
등급
(266)
프로젝트
598
35%
중재
64
20% / 58%
기한 초과
147
25%
무료
게재됨: 1 기고글, 22 코드
6
개발자 6
등급
(22)
프로젝트
29
3%
중재
4
25% / 0%
기한 초과
3
10%
작업중
7
개발자 7
등급
(3)
프로젝트
1
100%
중재
3
0% / 100%
기한 초과
0
무료
8
개발자 8
등급
(4)
프로젝트
8
0%
중재
3
33% / 67%
기한 초과
4
50%
무료
9
개발자 9
등급
(2)
프로젝트
3
0%
중재
0
기한 초과
0
무료
10
개발자 10
등급
(10)
프로젝트
15
27%
중재
0
기한 초과
3
20%
무료
11
개발자 11
등급
(40)
프로젝트
47
28%
중재
14
21% / 64%
기한 초과
1
2%
바쁜
12
개발자 12
등급
(1)
프로젝트
3
0%
중재
0
기한 초과
0
무료
13
개발자 13
등급
(2)
프로젝트
1
0%
중재
1
0% / 100%
기한 초과
0
무료
14
개발자 14
등급
프로젝트
0
0%
중재
0
기한 초과
0
무료
15
개발자 15
등급
프로젝트
0
0%
중재
0
기한 초과
0
무료
비슷한 주문
Hi, I’m looking for a top-tier, profit-optimized EA that has the potential to scale trading returns significantly. My goal is to maximize growth over time. Can you help develop a bespoke EA that could potentially scale to high six or seven figures
This is yakubu Jnr trading bots I create the trading robots to help my self and others traders to be successful please you can join my live trading bots or subscribe to my trading robots
Nyasco 90+ USD
Fast trading bot for starters less losses which leads to bigger profits made for thousands of people making billions of dollars .be the best trader for your self all the way
Nyasco 30+ USD
Faster robot with less losses which can be used for a long term earning money every day creating a bot for more than thousands of people to earn billions of money
Max amount grid 30+ USD
max amount grid step for magic number do keep deleting .only when it is in negative floating .but when it is profit allow to go over the max and replays to grid step
Apply with a screen of your work . Symbol Specific Logic . Live Chart Optimization Check the Core logic . [back tests as well] Change points to pips . Create buffer for the zone
I will pay 3000+ USD (negotiable) for an EA for existing MT5 that generates a minimum of 15-20% or higher a month consistently (provide source code after final deal) Looking for a highly profitable EA Please send demo version directly subject (Buying profitable EA Budget up to $ 3000 USD), past results and optimal settings so I can test, if it performs in a strategy tester i will also need option to forward test it
EA fx 30+ USD
Hello, I need an already developed EA similar to the one trading XAUUSD, with consistent entries and good risk management. Before we proceed, I would like to verify its performance. Please provide a live or demo account login along with the investor (read-only) password so I can monitor the trading results. I am looking for stable performance, controlled drawdown, and consistent profit on gold (XAUUSD). Once I
The strategy records the highest and lowest prices within a specified duration (default 15 minutes) after the New York market opens, forming the opening range. Post-Formation Breakout: When the price breaks above or below the opening range after its formation, it may indicate the direction of the day’s price movement. Trend Confirmation: The strategy uses two EMAs (default 20-period and 50-period) as trend filters to

프로젝트 정보

예산
250 - 350 USD
기한
에서 1  5 일