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_barsbars in a row - For
release_barsbars 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
optionsblock 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 stoptake_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 stopexit_on_basis- close the position when a closed bar returns past the Keltner Channel middle line (off by default)entry_filter- extra entry filters (see below)
Entry filters entry_filter - they only restrict new entries and never block exits. All are off by default.
When several are on, an entry is allowed only if all of them pass.
trend_ma- trend filter: long only when the close is above the MA, short only below.trend_ma_type,trend_ma_source,trend_ma_len- MA type, source and period (default EMA, close, 200)adx- trend strength filter by ADX with periodadx_len(14).adx_min- enter only when ADX is at least this value (default 20),adx_max- only when it is at most this value (for range strategies). 0 - don't checkliquidity- liquidity filter: enter only if the average daily turnover (volume × price) overliquidity_daysdays (7) is at leastliquidity_min_usdt(100000 USDT)time- enter only in the given hours and weekdays, UTC.time_hours_utc- comma-separated hour ranges, the end is excluded:"8-12,14-20","22-2"- across midnight (default"0-24").time_weekdays- weekdays, 1 = Monday ... 7 = Sunday:"1-5"(default"1-7")
Backtest the strategy on historical data in the tester and run it in hamster-bot.