Squeeze Expansion System
A squeeze is the popular TTM condition: Bollinger Bands pulled inside a Keltner Channel, meaning the standard-deviation bands have gone narrower than the ATR-based channel - volatility compressed to the point that a release, in one direction or the other, becomes likely. Most published versions trade every release blind, taking whichever direction the first post-squeeze bar happens to lean. This system adds two checks that matter in practice. First, a direction vote taken only at the release bar: momentum (a Momentum oscillator reading above or below its 100 midline) and price structure (the release bar's close breaking the recent InpStructureBars high or low) both have to agree. A release with no clear momentum, or one where momentum and structure point opposite ways, is skipped rather than guessed at. Second, a time-out. A squeeze that has sat compressed for more than InpMaxSqueezeBars closed bars without releasing is marked dead - if it eventually does release after that point, the signal is ignored. The reasoning is that a squeeze which has already failed to resolve for that long has usually stopped being the coiled-spring setup it looked like early on, and trading it late invites exactly the chop the squeeze concept exists to avoid. Notes and limitations - One position at a time. New releases are only evaluated while flat. - The stop and target are fixed at entry - there is no trailing management, so a strong expansion can retrace a long way before the target is reached. - The direction vote can reject a release entirely; a squeeze firing with disagreeing momentum and structure produces no trade at all, which is intentional, not a missed signal. - The timeout only prevents trading a release AFTER the squeeze has been marked dead; a squeeze that releases at bar InpMaxSqueezeBars+1 itself is still traded normally, since the check runs once per closed bar. - Lot sizing uses MODE_TICKVALUE/MODE_TICKSIZE, not a hardcoded contract size.
Expert advisor · MT5 · v1.0 · Free
About Squeeze Expansion System
Squeeze Expansion System is an expert advisor (trading robot) for MetaTrader 5 based on Moving Average, Bollinger Bands, ATR and Momentum. It can size trades from your balance and risk percent. It has 18 settings, such as Bb period, Bb deviation and Kc period. MQL source code included.
Files in the download: SqueezeExpansionSystem.ex5, SqueezeExpansionSystem.mq5, SqueezeExpansionSystem.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 |
|---|---|---|
| Bb period | 20 | Bollinger Bands period |
| Bb deviation | 2.0 | Bollinger Bands standard-deviation multiple |
| Kc period | 20 | Keltner Channel EMA period |
| Kc atr period | 20 | Keltner Channel ATR period |
| Kc atr multiple | 1.5 | Keltner Channel ATR multiple |
| Momentum period | 12 | Momentum lookback for the direction vote, in bars |
| Structure bars | 5 | Bars back for the structure vote (higher high / lower low) |
| Max squeeze bars | 40 | Squeeze retires (stops watching) once compressed this many bars without releasing |
| Stop atr multiple | 2.0 | Initial stop distance, ATR multiples |
| Target atr multiple | 3.0 | Take profit distance, ATR multiples |
| Atr period | 14 | ATR period used for the stop and target |
| Use risk sizing | false | Size by percent risk to the initial stop instead of a fixed lot |
| Risk percent | 1.0 | Percent of equity risked per trade, used only when risk sizing is on |
| Fixed lots | 0.10 | Lot size when risk sizing is off, or as a fallback |
| Magic number | 20260361 | 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 5 open File → Open Data Folder, then go to MQL5 → Experts.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 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: Bollinger Bands · ATR · Momentum · Channels & Envelopes · Risk & Lot Size · Moving Average · MT5 Expert Advisor · MQL5 Source Code