Atrex Lossbreaker
- 实用工具
- 版本: 1.0
- 激活: 5
ONE BAD TRADE SHOULD NOT TAKE A WEEK OF PROFIT. ATREX LOSSBREAKER CUTS IT AT A DISTANCE THE MARKET ITSELF SETS.
Atrex Lossbreaker is a volatility-adaptive emergency loss cut for MetaTrader 5. For every position in scope, by hand or by another Expert Advisor, it measures the ATR of that symbol the moment it first sees the trade and stores it. When price moves against the entry by more than N times that ATR, the position is closed. A quiet pair gets a tight limit, gold on a busy day gets a wide one, and you never type a stop in points again.
Built for traders who sometimes trade without a stop loss, forget to set one, or run EAs whose stops are too wide or missing: the manual scalp that turns into a hold, the grid or copier that keeps a losing leg open, the news spike on a position with no exit. One promise: no position in scope can lose more than the distance you chose, measured in the market's own volatility. The rule in one line: limit = multiplier x ATR(period) on the timeframe you pick, stored at first sight; with the defaults (2.0 x ATR 14, H1) and an H1 ATR of 103 points on EURUSD, a sell is closed when price is 206 points above its entry.
From the Strategy Tester log (EURUSD H1, 1 June 2026, defaults): a demo sell had an ATR of 103 points when it opened, so its limit was 206 points; at 09:57 the move against it reached 219 points and it was closed in the same pass with the line "move against it 219 pts reached 2.0 x ATR 103 pts = 206 pts" in the journal. A buy opened in a calmer hour had an ATR of 75 points, a limit of 150 points, and was closed at 151.
Works with: manual trades, other Expert Advisors and trade copiers on the same terminal (symbol scope and magic filter decide which trades are watched), hedging and netting accounts, every symbol (forex, gold, indices, crypto), and prop-firm style rules such as a maximum loss per trade. It never opens a trade on your account and never changes a stop loss or take profit: your own stops keep working, the loss breaker is the emergency line behind them.
Try it free first: run Atrex Lossbreaker in the Strategy Tester with visual mode on. There it opens a small demo trade every third hour on weekdays, so you can watch each trade's bar fill up and the ones that run 2 ATR against the entry being closed.
Why the ATR is frozen at entry: the limit is measured once, when the loss breaker first sees the position, and kept for the life of the trade. A live ATR would grow during a panic move and push the exit further away exactly when you need it most. A frozen ATR gives every trade a fixed, known worst case that you can read on the panel from the first second.
Who this is NOT for: traders looking for an entry robot, and anyone who wants positions to ride out any move without a limit; for EAs that must never be closed, exclude them with the magic filter or the chart symbol scope.
A worked example (default settings)
EURUSD, ATR(14) on H1 = 103 points when the trade opens. Limit = 2.0 x 103 = 206 points. 10:00: a manual sell opens at 1.16471, the panel shows its bar at 0 percent, state INSIDE. 10:40: price is 1.16636, 165 points against the sell: the bar is 80 percent full, it turns amber, the state reads NEAR LIMIT and one alert says so. 11:05: price reaches 1.16677, 206 points against: the position is closed at market (ATR CUT) and the journal shows the numbers. A buy opened at the same moment on gold would get its own limit from gold's own ATR.
In short
- Limit per position = multiplier x ATR(period, timeframe), stored at first sight and kept after a terminal restart.
- Optional second rule: a money cap per position in your account currency; whichever is reached first closes the trade.
- Only positions opened after you attached it are handled; one switch also protects positions that were already open.
- One alert at 80 percent of the limit, so you can act before the cut.
- Alert-only mode: one alert per position over the limit, nothing sent.
- Panel with real trading data: a percent bar per position (move against it vs its own limit) with 50 and 80 percent marks, closest to the cut first, limit and move in points, loss cuts with their result.
- Not a grid, no martingale, no DLLs, no web requests.
- Tester numbers (June 2026, EURUSD H1, defaults): 156 demo trades, 75 closed by the 2 ATR rule, 0 failed sends, 0 journal errors.
START HERE
Attach it to one chart, for example EURUSD H1. One copy watches every symbol of the account unless you limit it. Turn on Algo Trading. To watch first, switch to ALERT ONLY with the panel button. The first setting to change is the ATR multiplier: lower it from 2.0 to 1.5 for a tighter emergency line on scalps, raise it to 3.0 for swing trades that need room.
How one position is handled
First sight. The loss breaker sees a new position in scope, measures ATR on its symbol and timeframe and stores it with the position id.
Watching. On every tick and every second it measures how far price has moved against the entry (bid for a buy, ask for a sell) and shows it as a percent of the limit.
Near. At 80 percent the bar turns amber, the state reads NEAR LIMIT and one alert is sent (can be switched off).
Cut. At 100 percent of the ATR limit, or when the loss reaches the money cap, the position is closed at market with the slippage you allow: state LOSS CUT, history ATR CUT or MONEY CUT.
From earlier. A position opened before the loss breaker was attached is shown with a grey bar and BEFORE START, and is never closed unless you turn on InpIncludeExisting.
Market closed. Nothing is sent while the symbol session is closed or the quote is stale; the banner reads OVER THE LIMIT - MARKET SHUT, WAITING and the cut is sent when trading opens.
Safety patterns inside
Before any close it checks that Algo Trading is allowed, that the symbol session is open and that the last quote is no older than 5 minutes. Right before each close the position is selected again and its symbol, magic and position id are compared with the plan, so a different position is never closed by mistake. A refused close is retried with a growing pause up to 2 minutes and a different filling type, with one alert after a set number of failures. The ATR snapshot and what was already done are kept in GlobalVariables whose keys contain the chart symbol, the magic filter, the magic number and the position id, so two copies never share a key and a restart neither changes the limit nor handles the same trade twice. Wrong input values (for example an ATR period of 0) stop it at start with a clear message instead of guessing.
Inputs, every one explained
LOSS CUT RULES
InpMode = 1. 0 alert only, 1 loss cut (close positions over the limit).
InpAtrTF = H1. Timeframe of the ATR; the current chart timeframe can be chosen too.
InpAtrPeriod = 14. Number of closed bars in the ATR.
InpAtrMult = 2.0. The position is closed when the move against it reaches this many ATRs.
InpMoneyCap = 0. Optional loss cap per position in account currency (profit plus swap); 0 = off.
InpIncludeExisting = false. Also protect positions that were already open when you attached it.
EXECUTION
InpSlippagePts = 30. Allowed slippage for a loss cut, in points.
InpFailAlertAt = 3. One alert after this many failed attempts.
FILTER - WHICH TRADES ARE COUNTED
InpSymbolScope = all symbols or the chart symbol only. InpMagicFilter = any magic, only manual trades (magic 0), or only the magic number InpMagic.
ALERTS
InpAlertPopup = true. InpAlertPush = false (push to the MetaTrader app on your phone). InpAlertNear = true (one alert when a position reaches 80 percent of its limit).
PANEL
ShowPanel = true. PanelX = 12, PanelY = 15, PanelFontSize = 9, MaxTableRows = 6, MaxHistoryRows = 4. The MOVE button drags the panel; on a short chart it drops its least important rows first.
STRATEGY TESTER DEMO
InpTesterDemo = true. Strategy Tester only: Monday to Friday one demo trade every third hour (01, 04, 07 ... 22) with a stop 3 ATR and a take profit 2 ATR away, at most 5 open, margin checked x 1.5, closed after 1 day, stopped after a 20 percent balance loss. This code never runs on a live or demo chart.
The panel
MOVE AGAINST vs ATR LIMIT, CLOSEST FIRST: one bar per position with symbol, side and ticket, filled green, blue past 50 percent, amber past 80 percent and red at the limit, with the percent beside it and the rule (for example 2.0 x ATR(14) H1) in the header. LOSS BREAKER PLAN: the ATR rule, the money cap, the position with the highest use of its limit, loss cuts split into ATR and money with their result, open positions and profit, mode, last action, Algo Trading, failed sends and totals. OPEN POSITIONS: symbol, side, lots, limit in points, move against it in points, profit and state, with a red edge on rows being closed. ACTION HISTORY lists every cut, near alert and button press with server time. QUICK CONTROLS: ARMED or PAUSED, the mode button and CHECK NOW. The right side of the chart stays clear.
Common questions
Does it replace my stop loss? No. It is an emergency line on the terminal side. A broker-side stop also works when your terminal is off; keep it if you have one.
Does it open trades by itself? No. On a live or demo chart it only closes positions over their limit. Demo trades exist only inside the Strategy Tester.
Will it close my trades from yesterday? Only if you turn on InpIncludeExisting. By default positions opened before you attached it are shown but never closed.
Why does the limit not change while the trade is open? On purpose: see "Why the ATR is frozen at entry" above. A new position gets a fresh ATR.
What it cannot do
It closes at market after the limit is reached, so a gap or a fast spike can fill beyond the limit; the slippage input decides how far a fill may move. It only works while it runs: keep the terminal on, for example on a VPS.
What was and was not tested
Tested in the Strategy Tester on a hedging account, 1 to 30 June 2026, 1-minute OHLC, H1, deposit 10000, leverage 100, with no journal error and no failed send. EURUSD defaults: 156 demo trades, 75 closed by the 2 ATR rule. XAUUSD alert only with 1.5 x ATR and a money cap of 150 USD: 142 demo trades, 177 alerts (21 over the ATR limit, 66 over the money cap, 90 near the limit), nothing sent. On a demo chart the panel ran in alert-only mode with InpIncludeExisting on, beside 4 EURUSD positions from earlier, on a weekend with the market closed: 3 showed over the limit and waiting, nothing was sent.
Not tested at the time of writing: real closes on a live or demo broker, a netting account, retries after a broker refusal, chart symbol scope, magic filters, pop-up and push alerts and a terminal restart. These paths exist in the code and are described by design. Please try them on a demo account with your own broker first.
Try it in the Strategy Tester
Choose Atrex Lossbreaker, EURUSD or XAUUSD, H1, any recent month, visual mode, and press Start. Watch the bars fill and the trades that run 2 ATR against you close.
If the loss breaker stopped a trade before it became a disaster, or you think it should treat a case differently, an honest review on the product page helps other traders decide and tells me what to improve next.
