No Hedge Guard
- Yardımcı programlar
-
Augusto Martin D'anna
MQL5 & Pine Script developer | Trader since 2019 | Strategy validation
As a trader, I know a bot is only as good as the logic behind it. I bridge
trading concepts and clean code: I don't just follow instructions, I make
sure your EA behaves exactly the way your strategy intends. - Sürüm: 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.
