No Hedge Guard
- 实用工具
-
Augusto Martin D'anna
你好,欢迎访问我的个人资料。我是 Augusto Danna,拥有7年经验的交易员。我擅长结合市场经验与编程技能来实现交易策略的自动化。如有任何疑问,欢迎随时联系我!
自动交易系统: 开发 MT4 和 MT5 的智能交易系统 (Expert Advisors)。
自定义指标: 开发和修改技术指标。
高级风险管理: 实施移动止损 (Trailing Stop)、保本 (Breakeven) 和动态手数计算。
策略转换: 将 TradingView (Pine Script) 策略转换为 MQL4/MQL5。
策略优化: 策略回测与参数调整。 - 版本: 1.0
No Hedge Guard keeps a hedging account free of hedges. If a buy and a sell are open on the same symbol at the same time, it closes the newer side at once. It works for manual trades and for any EA, and it never opens trades.
Many prop firms do not allow hedging, and when two EAs trade the same symbol a hedge can appear by accident. Attach this utility to one chart and it watches the whole account.
What it does
- Reacts to every new deal and also checks once per second.
- For each symbol it keeps the oldest position's direction and closes any newer position in the opposite direction.
- Alert-only mode if you just want to be warned.
- Optional magic number filter, for example to guard only your EAs and leave a manual hedge alone.
- Status on the chart: symbols watched, action, positions closed so far and the last event.
Inputs
- When a hedge appears: close the newer opposite position, or alert only
- Symbols to watch: all symbols of the account, or only the chart symbol
- Magic numbers to watch, comma separated (empty = all, 0 = manual trades)
- Popup alert on/off, status on the chart on/off
Notes
- The newer position is closed at market, so you pay its spread and commission. The aim is to stay inside your firm's rules, not to avoid that cost.
- It cannot stop the order from being sent: it closes the position right after it opens. If your firm counts even a few seconds of hedge as a violation, also fix the cause (for example, do not run two EAs in opposite directions on one symbol).
- On netting accounts a hedge is impossible, so the utility has nothing to do.
- Tested on a MetaQuotes demo account: a buy from one EA and a sell from another on EURUSD, the sell was closed immediately.
