Loading…

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

SettingDefaultWhat it does
Channel period20Donchian channel lookback, in bars
Atr period14ATR period
Percentile lookback100Bars of ATR history used to rank the starting-state reading
Max entry percentile25.0Maximum percentile rank (0-100) the starting ATR may sit at
Stop atr multiple1.5Protective stop, in ATR multiples
Reward multiple2.0Take profit, as a multiple of the stop distance
Use risk sizingfalseSize by percent risk instead of a fixed lot
Risk percent1.0Percent of equity risked per trade, when risk sizing is on
Fixed lots0.10Lot size when risk sizing is off, or as a fallback
Magic number20260605Magic number for orders opened by this EA
Slippage pips3Slippage tolerance, in pips
Max retries5Attempts per trade action before giving up
Retry wait ms500Pause between attempts, milliseconds

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Experts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
  6. Test it first on a demo account or in the Strategy Tester.

Download the PDF guide

Tags: Breakout · ATR · Channels & Envelopes · Risk & Lot Size · MT4 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria