Low Volatility State Breakout
Most volatility-aware breakout filters look at ATR right at the moment of the breakout. This one looks earlier: at the ATR reading from the bar where the current breakout channel began, ranked against a long history of ATR readings to produce a percentile. A channel that started from an already-wide ATR reading has less genuine room to expand into even if the breakout itself looks clean; a channel that started from a quiet, low-percentile reading has been coiling from a real low-volatility base, which is the setup this EA is built to catch. The channel is a standard Donchian breakout - price closing beyond the highest high or lowest low of the recent lookback window - but it is only tradeable when the ATR reading at the START of that lookback window ranks at or below a configurable percentile of the last N historical ATR readings. A wide-open channel breakout with a high starting-state percentile is logged and skipped. Once in, the stop and take profit are both sized from the current ATR: a fixed multiple for the stop, and a reward multiple of that stop distance for the target, giving every trade the same risk:reward structure regardless of instrument or timeframe. Notes and limitations - This project reimplements the catalogue's standard helper functions (retryable-error classification, pip/lot normalisation, position lookup by magic number) locally rather than including another project's file, per house style - each submission is self-contained. - Requires InpChannelPeriod + InpPercentileLookback + InpAtrPeriod bars of history before it will evaluate a signal; on a fresh chart or an illiquid symbol with short history this can delay the first possible trade. - The percentile rank is a simple count-at-or-below calculation over a fixed window, not a statistically smoothed distribution estimate; it can shift noticeably as old readings roll out of the window. - No trailing stop - the position is managed by the fixed ATR stop and reward-multiple target only. - Signals are evaluated once per closed bar, not on every tick. - One position at a time, tracked by InpMagicNumber. - Requires AutoTrading enabled (IsTradeAllowed()); if trading is disabled the EA logs it and skips the entry.
Expert advisor · MT4 · v1.0 · Free
About Low Volatility State Breakout
Low Volatility State Breakout is an expert advisor (trading robot) for MetaTrader 4 based on ATR. It can size trades from your balance and risk percent and trades breakouts. It has 13 settings, such as Channel period, Atr period and Percentile lookback. MQL source code included.
Files in the download: LowVolStateBreakout.ex4, LowVolStateBreakout.mq4, LowVolStateBreakout.txt.
Trading robots can lose money. Check every setting and test on a demo account before using real funds.
Settings
| Setting | Default | What it does |
|---|---|---|
| Channel period | 20 | Donchian channel lookback, in bars |
| Atr period | 14 | ATR period |
| Percentile lookback | 100 | Bars of ATR history used to rank the starting-state reading |
| Max entry percentile | 25.0 | Maximum percentile rank (0-100) the starting ATR may sit at |
| Stop atr multiple | 1.5 | Protective stop, in ATR multiples |
| Reward multiple | 2.0 | Take profit, as a multiple of the stop distance |
| Use risk sizing | false | Size by percent risk instead of a fixed lot |
| Risk percent | 1.0 | Percent of equity risked per trade, when risk sizing is on |
| Fixed lots | 0.10 | Lot size when risk sizing is off, or as a fallback |
| Magic number | 20260605 | Magic number for orders opened by this EA |
| Slippage pips | 3 | Slippage tolerance, in pips |
| Max retries | 5 | Attempts per trade action before giving up |
| Retry wait ms | 500 | Pause between attempts, milliseconds |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Experts.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
- Test it first on a demo account or in the Strategy Tester.
Tags: Breakout · ATR · Channels & Envelopes · Risk & Lot Size · MT4 Expert Advisor · MQL4 Source Code