PROTECTED SOURCE SCRIPT

Inside Bar Range Boxes — Volume Break out by Sparkfx v2

67
Confirm on close + buffer ticks (close must beat the box by a cushion)

Minimum box size (in ATR or %)

Minimum “compression length” (N consecutive inside bars)

Trend filter (EMA 200) (only buy above / sell below)

Volume filter (breakout vol > SMA vol)

Cooldown (no new signals for X bars after a breakout)
Mother-bar range box: When a candle is inside the previous candle (high ≤ prev high AND low ≥ prev low), the script marks the previous bar as the mother bar and draws a shaded box from that bar’s high/low.

The box extends to the right until price breaks out above the high or below the low.

On breakout it can color the border (green = up, red = down), optionally print BUY/SELL labels, and either keep the box or delete it.
Visuals

Box Fill / Border / Width: appearance of the range.

Bull/Bear Break Border: colors used once a breakout is detected.

Show BUY/SELL arrows: show small labels at the breakout.

Keep old boxes after breakout: leave history on chart.

Extend box forward (bars): safety limit so boxes don’t run forever.

Shrink to each NEW inside bar: if another inside bar appears within the active box, the range tightens to that newest mother
Require bar close outside box: wait for a candle close to confirm the break (less noise).

Buffer (ticks): require price to clear the box by N ticks (prevents 1-tick fakeouts).

Min box size (ATR x) and ATR length: ignore tiny boxes (e.g., min 0.25× ATR).

Min consecutive inside bars: only start a box after 2+ consecutive inside bars (more compression = cleaner moves).

Cooldown after breakout (bars): suppress new signals for X bars after a break..
Trend filter (EMA 200):

Buy only if price > EMA(200)

Sell only if price < EMA(200)

Volume filter: breakout volume must be > SMA(volume).
Maintain box: extend right each bar; optionally shrink to newer inside bars.

Breakout test:

Up: (close or high) > boxHigh + buffer

Down: (close or low) < boxLow - buffer

Apply trend, volume, and cooldown filters.

On breakout: color border (green/red), place label if enabled, optionally keep or delete the box, and fire an alertcondition.
Alerts included

Inside Bar Bullish Breakout (Filtered)

Inside Bar Bearish Breakout (Filtered)

They only trigger when all enabled filters pass.

How to use (quick playbook)

Turn on Require close and set Buffer = 1–2 ticks.

Set Min box size = 0.25–0.40 ATR, Min consecutive inside bars = 2.

Enable Trend filter (EMA 200) and optionally Cooldown = 5–10 bars.

Trade breakouts in the trend direction; place stops beyond the opposite side of the box.

If you want more trades, loosen ATR multiple or turn off the trend filter; if it’s too chatty, increase ATR multiple / consecutive bars.

Why your boxes may differ from other indicators

This script uses high/low wicks with optional tightening (if enabled), tolerance buffer, confirmation on close, and extra filters—all of which can make boxes and signals diverge from a “pure” inside-bar tool that draws on first detection without filters.

Exención de responsabilidad

La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.