Watch how to download trading robots for free
Find us on Facebook!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Experts

No Hedge Guard - close the newer side when a buy and a sell are open on one symbol - expert for MetaTrader 5

Augusto Martin D'anna
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.
Views:
28
Published:
cb_nohedge.png (78.73 KB)
MQL5 Freelance Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

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 it to one chart and it watches the whole account.

How it works

  • OnTradeTransaction reacts to every new deal, and a 1-second timer checks again.
  • For each symbol it finds the oldest watched position (POSITION_TIME_MSC) and closes every newer position in the opposite direction.
  • Alert-only mode, optional magic number filter (0 = manual trades), status on the chart.

Inputs

  • When a hedge appears: close the newer opposite position, or alert only
  • Symbols to watch: all symbols or only the chart symbol
  • Magic numbers to watch, comma separated (empty = all)
  • Popup alert, status on the chart

Notes

  • It closes the position right after it opens; it cannot stop the order from being sent. Fix the cause too (for example, two EAs in opposite directions on one symbol).
  • On netting accounts a hedge is impossible, so there is nothing to do.
  • Tested on a MetaQuotes demo: a buy from one EA and a sell from another on EURUSD, the sell was closed immediately.
Chart Pattern Breakout Indicator Chart Pattern Breakout Indicator

Breakout status and measured targets for 13 chart patterns: channels, wedges and triangles found on zigzag swings, each shaded by what price did after its last swing (forming, broke up, broke down, target hit, failed) and rated with a quality score. Larger patterns stay around the smaller ones inside them, and same-size patterns never pile up.

Giano Session Range Breakout EA Giano Session Range Breakout EA

Night session range breakout for XAUUSD: one decision per day, a hash-chained journal written before every order, and safe recovery after restarts.

News Day Blocker - no new trades on US CPI and FOMC days News Day Blocker - no new trades on US CPI and FOMC days

Blocks new trades on US CPI and FOMC days (New York date). Built-in calendar 2015-2027, works in the Strategy Tester. Never opens trades.

NyTime - broker server time to New York time with US and EU daylight saving NyTime - broker server time to New York time with US and EU daylight saving

Converts broker server time to UTC and New York time with US and EU daylight saving rules. Works the same live and in the Strategy Tester, where TimeGMT() returns server time.