Appearance
Personalize your experience
Liquidity Impact Breakout
FreeRange breakouts when Amihud illiquidity is high
Live engine preview
The QuaScript engine's own output on the chart the terminal uses. Change the settings or edit the code and press Run to recompute it.
About
Takes range breakouts when liquidity is thin. Amihud illiquidity (absolute return per unit of traded value) is ranked against its own history; when it is high, a given order moves price further, so breakouts through a recent range tend to travel instead of being absorbed. Entry: close beyond the N-bar range with the illiquidity rank above the threshold. Exit: stop at the range middle, target `reward` R, trailing after 1R. Risk: 1 % per trade. Method: Amihud (2002) illiquidity, percentile rank.
Settings
Range bars: 36
Illiquidity window: 24
Rank history: 500
Thin-liquidity rank: 70
Target (R): 2
Measured backtests
Run by the backtest engine on public candles, 2025-11-01 to 2026-11-01, with the script's own commission and slippage, on BTCUSDT 1h (Binance) and ETHUSDT 1h (Binance). The figures per market are in the Measured backtest panel below. Past results do not predict future returns.
Backtest it yourself
Open it on the backtesting page to run it on any symbol, interval and date range, then use Monte Carlo, optimisation, walk-forward and robustness tests.
Strategy Rules
Entry Conditions
- ▸ close beyond the N-bar range with the illiquidity rank above the threshold
Exit Conditions
- ▸ stop at the range middle, target `reward` R, trailing after 1R
Measured backtest
BTCUSDT 1h (Binance), 2025-11-01 to 2026-11-01 · backtest engine, script costs included
-10.4%
Return
-0.85
Sharpe
-14.1%
Max DD
31.1%
Win Rate
74
Trades
| Market | Trades | Return | Sharpe | Max DD | Win rate | Profit factor |
|---|---|---|---|---|---|---|
| BTCUSDT 1h | 74 | -10.4% | -0.85 | -14.1% | 31.1% | 0.79 |
| ETHUSDT 1h | 72 | -14.6% | -1.45 | -17.6% | 27.8% | 0.71 |
Past results on historical data do not predict future returns.
Source Code
Edit in IDE| 1 | strategy "Liquidity Impact Breakout" { |
| 2 | overlay = true |
| 3 | capital = 100000 |
| 4 | commission = 0.05 |
| 5 | slippage = 1 |
| 6 | sizing = risk_percent |
| 7 | max_leverage = 1 |
| 8 | size = 1 |
| 9 | pyramiding = 1 |
| 10 | } |
| 11 | /// Takes range breakouts when liquidity is thin. Amihud illiquidity (absolute return per unit of |
| 12 | /// traded value) is ranked against its own history; when it is high, a given order moves price |
| 13 | /// further, so breakouts through a recent range tend to travel instead of being absorbed. |
| 14 | /// Entry: close beyond the N-bar range with the illiquidity rank above the threshold. Exit: stop at |
| 15 | /// the range middle, target `reward` R, trailing after 1R. Risk: 1 % per trade. |
| 16 | /// Method: Amihud (2002) illiquidity, percentile rank. |
| 17 | use "viz/premium" as pr |
| 18 | range_n = param.int(36, title = "Range bars", min = 5, max = 500, group = "Breakout") |
| 19 | ami_len = param.int(24, title = "Illiquidity window", min = 5, max = 500, group = "Liquidity") |
| 20 | rank_n = param.int(500, title = "Rank history", min = 50, max = 5000, group = "Liquidity") |
| 21 | thin = param.float(70, title = "Thin-liquidity rank", min = 30, max = 99, group = "Liquidity") |
| 22 | reward = param.float(2.0, title = "Target (R)", min = 0.5, max = 10, step = 0.1, group = "Risk") |
| 23 | hi = ta.highest(high, range_n) |
| 24 | lo = ta.lowest(low, range_n) |
| 25 | mid = (hi + lo) / 2 |
| 26 | rank = stat.percent_rank(hft.amihud(ami_len), rank_n) |
| 27 | thin_now = rank > thin |
| 28 | flat = position.size == 0 |
| 29 | up_b = thin_now and close > hi[1] |
| 30 | dn_b = thin_now and close < lo[1] |
| 31 | if flat and up_b { |
| 32 | order.market("L", side.long) |
| 33 | exit.bracket("L exit", entry = "L", stop = mid[1], target = close + (close - mid[1]) * reward, trail_offset = close - mid[1], trail_trigger = close + (close - mid[1])) |
| 34 | } |
| 35 | if flat and dn_b { |
| 36 | order.market("S", side.short) |
| 37 | exit.bracket("S exit", entry = "S", stop = mid[1], target = close - (mid[1] - close) * reward, trail_offset = mid[1] - close, trail_trigger = close - (mid[1] - close)) |
| 38 | } |
| 39 | risk.max_drawdown(25) |
| 40 | ph = render.line(hi, "Range high", color = color.translucent(color.amber.300, thin_now ? 20 : 70), width = 1) |
| 41 | pl = render.line(lo, "Range low", color = color.translucent(color.amber.300, thin_now ? 20 : 70), width = 1) |
| 42 | render.band(ph, pl, color = color.translucent(color.amber.500, thin_now ? 88 : 98), opacity = 1, title = "Range") |
| 43 | render.mark(up_b, shape = shape.arrow_up, at = anchor.below_bar, color = color.amber.300, text = "Thin", title = "Thin breakout up") |
| 44 | render.mark(dn_b, shape = shape.arrow_down, at = anchor.above_bar, color = color.amber.300, text = "Thin", title = "Thin breakout down") |
| 45 | persist t = draw.table.create(anchor.top_right, 4, 2) |
| 46 | if bar.is_last { |
| 47 | pr.heading(t, 2, "Liquidity Impact Breakout", "Strategy · Amihud illiquidity") |
| 48 | pr.row(t, 2, "Illiquidity rank", str.format("{:.0f} / 100", rank), thin_now ? pr.WARN : color.white) |
| 49 | pr.row(t, 3, "Breakouts", thin_now ? "Followed" : "Ignored", color.white) |
| 50 | } |
| 51 |
Reviews
No reviews yet. Be the first to review this listing.