Source: https://hamster-bot.com/en/algo/squeeze

[← All strategies](https://hamster-bot.com/en/algo)

# Squeeze

A trend strategy that trades the breakout after a volatility squeeze (`squeeze`). A squeeze is when the Bollinger Bands sit entirely inside the Keltner Channel: the market has gone quiet and the range is narrower than usual. After such a lull the price often makes a strong move in one direction, and the strategy enters at its start.

- The squeeze must last at least `squeeze_min_bars` bars in a row
- For `release_bars` bars after the squeeze ends the strategy waits for a breakout: a closed bar closes above the upper Keltner Channel border for the first time - buy, below the lower border - sell
- Entry with a market order on the next tick after the signal bar closes
- Exit: stop, target and trailing stop in ATR (see below), and optionally a closed bar returning past the Keltner Channel middle line. The common exits from the `options` block work too

The bot chart shows the Bollinger Bands (blue) and the Keltner Channel (orange).

**ATR stop, target and trailing stop.** At entry the bot stores the ATR and computes the levels: stop = entry price ∓ `stop_atr` × ATR, target = entry price ± `take_atr` × ATR. The trailing stop follows the best price since entry at a distance of `trail_atr` × ATR and works together with the stop - whichever is closer to the price triggers. Levels are checked on every tick against the current price and the position is closed with a market order. Levels are saved in the bot state and survive a restart. If the position was opened manually or by another strategy, the levels are computed from its entry price and the current ATR.

**⚠️ False breakouts: after a squeeze the price can leave the channel and come straight back. In a sideways market without follow-through the strategy collects a series of small stops.**

#### Parameters

The `squeeze` block in the bot settings, `basic.strategy`: `squeeze`

- `bb_len`, `bb_mult` - Bollinger Bands period and width in standard deviations (default 20 and 2)
- `kc_len`, `kc_mult` - Keltner Channel period and width in EMA of true range (default 20 and 1.5)
- `squeeze_min_bars` - how many bars in a row the Bollinger Bands must stay inside the Keltner Channel to count as a squeeze (default 6)
- `release_bars` - for how many bars after the squeeze ends a breakout still counts as a signal (default 3)
- `atr_len` - ATR period for the stop, target and trailing stop (default 14)
- `stop_atr` - stop distance from the entry price in ATR (default 2). 0 - no strategy stop
- `take_atr` - target distance from the entry price in ATR (default 0 - no target)
- `trail_atr` - trailing stop from the best price in ATR (default 3). 0 - no trailing stop
- `exit_on_basis` - close the position when a closed bar returns past the Keltner Channel middle line (off by default)

**Entry filters** (MA trend, ADX, liquidity, time) are now set in the common `filter` block and work the same way in most other strategies - see «Position filters» in the «Position closing and common options» section. The old `entry_filter` block in the strategy settings is moved there automatically on load.

---

Backtest the strategy on historical data in the [tester](https://hamster-bot.com/en/tester) and run it in [hamster-bot](https://hamster-bot.com/en/download).
