Range Failure Reversal
- Experts
- 버전: 1.0
- 활성화: 5
Trades failed breakouts of a recent range when the market is not trending. Signals come from closed bars only. Every trade has a stop-loss, and it holds one position at a time.
Range Failure Reversal is an Expert Advisor that trades one idea. When price breaks out of a recent range but cannot stay outside it, and the market is not trending, it takes a position back towards the range.
How a signal is formed
- Range: the high and low of the last N closed bars on the signal timeframe (H1 by default). The range must be at least a set number of ATRs tall.
- Trend filter: Kaufman's efficiency ratio, measured before the signal bar. The EA trades only when it is low (absolute level or percentile of recent values). The filter can be switched off.
- One-bar rejection: a bar trades beyond the range edge by a limited distance (in ATR), closes back inside, and closes in the part of the bar away from the break.
- Two-bar failure (optional): one bar closes outside the range and the next bar closes back inside.
All calculations use closed bars. Signals do not repaint and do not look ahead.
Trade management
- Stop-loss beyond the extreme of the failed break, plus an ATR buffer, with a minimum distance.
- Take-profit as a multiple of the stop distance, the middle of the range, or the opposite side of the range.
- Optional break-even at a set R and a time exit after a set number of bars.
- One position at a time per symbol and magic number. No martingale, grid, averaging or hedging.
Risk controls
- Fixed lot, or % risk of balance per trade with a maximum lot.
- Daily loss limit as a % of the day-start balance, with optional closing of the open trade, and a maximum number of trades per day.
- Maximum spread as a fraction of ATR or in points. Trading-hours window and an optional no-Friday rule.
Broker conditions
Before each order the EA checks free margin, volume limits and step, stops and freeze levels, the symbol trade mode and whether the trading session is open. It runs OrderCheck and does not send modifications that change nothing. If free margin is not enough even for the minimum lot, the trade is skipped and a message is written to the log. After a failed request it waits before retrying. Signals are taken from a fixed timeframe (H1 by default), so the EA works the same on any chart timeframe.
Recommendations
- Run it in the Strategy Tester on your broker's data with "every tick based on real ticks" before using it, and then on a demo account.
- Use a separate magic number for each chart.
- Start with a low risk per trade. With "use minimum lot" on, a small account can risk more than the set % on each trade.
Testing performed (version 1.00)
The program compiles with no errors or warnings. In the Strategy Tester it opened and closed trades on EURUSD (M1 and H1 charts), GBPUSD (M30), XAUUSD (D1) and USDJPY (H1) with no errors in the journal. With a 1 USD deposit it skipped every trade with a "not enough free margin" message. Results with the default settings, as obtained (10,000 USD, 0.5% risk):
- EURUSD H1, 2024-01 to 2026-10 (OHLC on M1): 280 trades, net -320, profit factor 0.95.
- GBPUSD H1, same period: 292 trades, net -1,577, profit factor 0.77.
- XAUUSD H1, same period: 241 trades, net -1,434, profit factor 0.73.
- EURUSD H1, 2026-01 to 2026-10 (real ticks): 86 trades, net +11, profit factor 1.01.
These results do not show a profitable edge. The EA has not been forward-tested on a live account, and has not been tested on a netting account.
Risk disclosure
Trading leveraged products such as forex and CFDs carries a high level of risk and can result in the loss of all invested capital. This Expert Advisor opens and closes positions automatically. Backtest results depend on data quality, spreads and execution, and past results do not predict future results. The product does not promise or imply any profit. Test it on a demo account and use only money you can afford to lose.
Inputs
Signal
- Signal timeframe (Current = chart timeframe). Range length, closed bars. Minimum range height, x ATR.
- Minimum and maximum break beyond the range, x ATR. Rejection fraction (0-1).
- Also trade two-bar failures.
- Efficiency ratio period. Trend filter mode (Off, Absolute level, Percentile). Absolute level. Percentile and its window.
- ATR period. Allowed direction (both, buy only, sell only).
Exits
- Stop-loss buffer beyond the break extreme, x ATR. Minimum stop distance, x ATR.
- Take-profit mode (R multiple, middle of range, opposite side of range) and R multiple.
- Break-even at R (0 = off). Close after N bars (0 = off).
Risk
- Position size mode (Fixed lot / Risk %). Fixed lot. Risk %. Maximum lot.
- Daily loss limit % (0 = off). Close open position at the daily limit. Maximum new trades per day.
- Risk mode: use the minimum lot when the risk-based lot is smaller.
Filters
- Maximum spread, x ATR. Maximum spread, points. Trading window start and end hour (server time). No new trades on Friday.
Execution
- Magic number. Maximum slippage, points. Order comment. Draw the current range on the chart.
range reversal, failed breakout, false breakout, efficiency ratio, mean reversion, ATR stop, risk percent, daily loss limit, closed bar signals, no martingale, MT5 expert advisor, EURUSD
