OPEN-SOURCE SCRIPT

BRN Liquidity Channels BUY SELL

363
This indicator builds and tracks Liquidity Channels from confirmed pivot highs and pivot lows, then prints breakout signals when price breaks those channels. It is designed to be non-repainting because every structural decision (pivots, channels, and breaks) is only confirmed on closed candles.

1) What the system draws

The script maintains two independent channel “families”:

BEAR channels (red): built from pivot highs and represent a descending resistance structure.

BULL channels (blue): built from pivot lows and represent an ascending support structure.

Each channel has:

a midline (main slope line),

a top and bottom border (offset by a configurable percentage),

an optional fill between borders.

Channels are extended to the right while they remain “active”.

2) How pivots are detected (No repaint)

The script uses classic pivots:

ta.pivothigh(high, lenPivot, lenPivot)

ta.pivotlow(low, lenPivot, lenPivot)

A pivot is only accepted when barstate.isconfirmed is true, meaning the pivot point is fully confirmed and won’t change later.

3) How channels are constructed (structure rules)
BEAR channel creation (descending highs)

The script keeps an anchor high A (previous confirmed pivot high).

When a new pivot high B appears, it only qualifies if B < A (must be descending).

If it qualifies, the system either:

updates the most recent active BEAR channel by moving its “B point”, or

creates a new channel from A → B if no active channel can be updated.

If a pivot high does not satisfy B < A, the anchor resets (the new pivot becomes the new A), preventing invalid channel slopes.

BULL channel creation (ascending lows)

The script keeps an anchor low A (previous confirmed pivot low).

When a new pivot low B appears, it only qualifies if B > A (must be ascending).

If it qualifies, the system updates the most recent active BULL channel or creates a new one from A → B.

If the pivot low does not satisfy B > A, the anchor resets.

This “slope enforcement + restart” logic keeps channels structurally consistent.

4) How channels are extended in real time

For every active channel, the script projects the midline forward using the slope defined by points A and B. Then it extends:

midline to the current bar,

top border and bottom border using channelPct.

Visibility is controlled by inputs:

show midline,

show borders,

show fill.

5) Breakout detection (BUY/SELL logic)

Once channels exist, the script watches only the currently active and not broken channels:

BUY break: happens when close > top border of the active BEAR channel.

SELL break: happens when close < bottom border of the active BULL channel.

When a break happens, that channel is marked as broken and becomes inactive.

Optional break filter (2 moving averages)

A break can be filtered using two MAs:

For BUY: close must be above both MAs, and optionally MA1 > MA2 (momentum alignment).

For SELL: close must be below both MAs, and optionally MA1 < MA2.

This makes signals more selective by requiring trend confirmation.

6) Ping-Pong mode (visual/alert filter only)

The system includes a Ping-Pong mode that forces alternation:

After a BUY, the next plotted signal must be SELL.

After a SELL, the next plotted signal must be BUY.

Important detail: Ping-Pong does not change channel structure.
Even if a breakout is “repeated” (same direction as the last plotted signal), the script still:

breaks the channel,

updates structural state,

continues building channels normally.

Ping-Pong only decides whether the breakout becomes a visible label/alert on the chart.

7) Dot (circle) meaning

For each plotted signal, the script can display a small dot:

If the signal direction repeats (when Ping-Pong is off), the dot can be blue.

If the direction flips, the dot color reflects performance vs the last plotted signal:

green if the prior segment would be positive,

red if negative,

gray if neutral/unknown.

8) Non-repaint principle (why signals are stable)

The design avoids repainting by:

using confirmed pivots only,

evaluating breaks on confirmed bars,

updating channel geometry deterministically from confirmed A/B points.

So once a channel or signal is printed, it won’t shift historically.

If you want, I can also write a shorter “user manual” version (like a TradingView description) or a very technical version (step-by-step state machine explanation).

免責事項

この情報および投稿は、TradingViewが提供または推奨する金融、投資、トレード、その他のアドバイスや推奨を意図するものではなく、それらを構成するものでもありません。詳細は利用規約をご覧ください。