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
等级
(395)
项目
556
41%
仲裁
30
57% / 3%
逾期
57
10%
空闲
发布者: 11 代码
2
开发者 2
等级
(13)
项目
20
40%
仲裁
3
0% / 67%
逾期
3
15%
空闲
3
开发者 3
等级
(17)
项目
21
19%
仲裁
5
40% / 40%
逾期
0
空闲
4
开发者 4
等级
(510)
项目
978
74%
仲裁
27
19% / 67%
逾期
101
10%
空闲
发布者: 1 文章, 6 代码
5
开发者 5
等级
(268)
项目
603
34%
仲裁
65
22% / 57%
逾期
146
24%
工作中
发布者: 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
等级
(54)
项目
67
42%
仲裁
15
27% / 60%
逾期
1
1%
工作中
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
空闲
相似订单
Light 🕯️ 50+ USD
To apply, you must already have your EA running on an active MT5 trading account connected to the market. The account must have genuine trading history that can be independently reviewed and verified. EA Requirements 1. Prop-Firm Compatible Risk Management - The EA must include daily and overall drawdown protection. - Required inputs: "MaxDailyLoss = 5%" "MaxTotalDrawdown = 10%" - Once either limit is
Hello, I'm looking for developer or coder to create a custom expert advisor (EA) on mql4 according to my strategy. The developer should be able deliver both indicator and source code for the job. Thanks
​ Indicators: Fast MA (Period 10, Exponential) and Slow MA (Period 50, Exponential). ​ Buy Signal: When Fast MA crosses above Slow MA. ​ Sell Signal: When Fast MA crosses below Slow MA. ​ Risk Management & Parameters: ​Customizable Lot Size (Default: 0.01). ​Stop Loss (SL) and Take Profit (TP) in pips. ​Trailing Stop options. ​Max Spread filter. ​ Platform: MetaTrader 5 (MQL5)
​ Indicators: Fast MA (Period 10, Exponential) and Slow MA (Period 50, Exponential). ​ Buy Signal: When Fast MA crosses above Slow MA. ​ Sell Signal: When Fast MA crosses below Slow MA. ​ Risk Management & Parameters: ​Customizable Lot Size (Default: 0.01). ​Stop Loss (SL) and Take Profit (TP) in pips. ​Trailing Stop options. ​Max Spread filter. ​ Platform: MetaTrader 5 (MQL5)
A robot 30+ USD
Je souhaite trouver un développeur pour réaliser ce travail et effectuer les paiements via cette application. Je m'engage à ne communiquer avec les candidats que par cette application, y compris par messageries tierces, correspondance personnelle ou courriel. Je comprends que toute personne ne respectant pas ces conditions sera interdite de publier des commandes sur la plateforme Freelance
I am looking for an experienced MQL5/MT5 developer to develop a custom Expert Advisor based on a complete technical architecture already prepared by the client. This is not a request to design a trading strategy from scratch . The strategy architecture, entry/exit concepts, filters, risk-management requirements and testing requirements are already documented. The main responsibility will be MQL5 development
EAs 100+ USD
To apply, you must already have your EA running on an active MT5 trading account connected to the market. The account must have genuine trading history that can be independently reviewed and verified. EA Requirements 1. Prop-Firm Compatible Risk Management - The EA must include daily and overall drawdown protection. - Required inputs: "MaxDailyLoss = 5%" "MaxTotalDrawdown = 10%" - Once either limit is
Strategy 40 - 60 USD
yo i have a strategy i would really like to turn into a signal bot basically please this is very technical and serious to me the strategy needs more time 1 time frame and the bot most be 100% accurate
Ready to use bot 100+ USD
seller must provide the following to be considered... i will answer to all who fit this description, and can purchase more than 1 EA... - brief strategy description - overall EA expectancy - 1 week limited trial version, with whatever settings you consider best (can be blocked on demo, i don't really care) - investor password from a reputable broker (if history is available... live / demo, same thing, doesn't really
I want you to develop a professional HFT trading robot for MT5/MQL5 , initially focused on XAUUSD . The robot should be designed for high-speed tick-level trading , analyzing real-time bid/ask movement, spread, tick velocity, momentum, volatility, price acceleration and short-term market microstructure to identify very short-term opportunities. The core strategy should be capable of opening 5–10+ positions in a

项目信息

预算
250 - 350 USD
截止日期
从 1 到 5 天