Sweep Lead Lag [Zen]

472
Sweep Lead Lag [Zen] watches a basket of up to 20 crypto perpetuals and groups their liquidity sweeps into waves: a wave starts on the first closed candle on which any basket coin sweeps its pool and collects every coin that sweeps within a window of 6 candles counted from that first candle. For each wave the script records the role of the chart's own coin (Led, Joined or Absent) and what the chart's close did 12 candles after the wave ended, so you can check on the loaded history of this chart how price behaved after such waves.

All numbers below are default settings and can be changed in Inputs.

WHAT IS ORIGINAL AND WHY A SEPARATE PUBLICATION
A per-candle breadth count, such as my open-source Liquidity Sweep Breadth [Zen], shows in a lower pane how many coins swept on one candle. This script does something else with the same raw event:
- it joins sweeps that happen on different candles into one wave, with a fixed window counted from the first sweep;
- it records the order inside the wave: which coins swept on the first candle and how many candles later the others followed (the tooltip of every mark lists them);
- it classifies each wave by the role of the chart coin (Led, Joined, Absent) and keeps, for each role, a record of what the chart's price did after the wave;
- it shows the wave while it is still forming, with the number of coins so far and the position inside the window.
Pools, sweeps and basket requests are standard building blocks; the wave, the role and the outcome record per role are what this publication adds. It draws on the price chart, has no per-candle breadth series and no lower pane. It is a separate script, not an update of the breadth count, because the two answer different questions and share no logic beyond sweep detection.

HOW IT WORKS
- Basket: BTC, ETH, SOL, XRP, BNB, DOGE, ADA, LINK, AVAX, LTC, SUI, NEAR, AAVE, ONDO, DOT, TRX, BCH, UNI, APT, ARB. Each coin is requested as the chart's exchange + coin + USDT.P on the chart's timeframe, for example BITGET:ETHUSDT.P. A coin that has no such symbol on the chart's exchange is left out; a coin that has no candle at the time of the chart candle is not counted on that candle.
- Pool of a coin: the highest high and the lowest low of its previous 20 closed candles. A coin with fewer than 20 candles of history has no pool yet.
- Sweep: a closed candle whose wick goes beyond the pool and whose close comes back to or inside it (high above the high pool with a close at or below it; low below the low pool with a close at or above it).
- Wave: starts on the first closed candle on which any basket coin sweeps; the window is 6 candles, the first one included, and it always runs its full length. A coin belongs to the wave if it sweeps inside the window; each coin is counted once, on its first sweep. The wave is kept only if at least 5 coins swept inside the window; otherwise it is dropped and leaves no mark, no table entry and no alert. High-sweep waves (BSL, buy-side liquidity) and low-sweep waves (SSL, sell-side liquidity) are tracked separately and can run at the same time.
- Windows do not overlap: the next wave on the same side can start only on the candle after the window ends. A cluster of sweeps that straddles the end of a window is therefore split: its first sweeps go to that window, the rest can only open a new wave after it ends.
- Role of the chart coin: Led = the chart coin swept on the first candle of the wave (other coins may have swept on that candle too, so Led is order in time, not cause); Joined = it swept later inside the window; Absent = it did not sweep inside the window. The chart coin's own sweep is read from the candles of the chart itself. On a perpetual chart of a basket coin the chart coin is also part of the basket, so its sweep can open a wave. If the chart coin is not in the basket, its sweep cannot open a wave: a sweep before the first basket sweep is not counted, and the role stays Absent unless the coin sweeps again inside the window.
- Outcome: 12 candles after the last candle of the window, the close is compared with the close of that last candle. For a BSL wave the outcome is Fell when the later close is lower; for an SSL wave it is Rose when the later close is higher. An equal close is neither. A wave enters the table only once its outcome is known, so waves from the last 12 candles are still pending.

WHAT YOU SEE
- Marks: when a window ends and the wave is kept, a triangle is placed on the FIRST candle of the wave, 5 candles back from the candle that just closed (window length minus one). So the newest mark is always 5 candles behind the last closed candle, and a mark never appears on the open candle; once placed, it does not move. Orange triangle above the high for a BSL wave, blue triangle below the low for an SSL wave. Size: small for fewer than 10 coins, larger from 10 coins. The tooltip shows the count against the coins with data on that candle, for example "BSL 12/20", and every coin with its delay in candles from the first candle of the wave (+0 = swept on the first candle).
- Live label: while a window is open, a label on the last candle shows the side, the coins so far out of the coins with data, and the number of the current candle inside the window, the open candle included, for example "BSL 5/20" and "5/6". Coins are counted on closed candles only. If both sides are open, the label shows the side with more coins (BSL when equal); the table's bottom line lists both. The label is shown for every open window, including windows that will end with fewer than 5 coins and be dropped, and it disappears when the window ends.
- Table (top right by default), header: timeframe and the outcome horizon. One row per role of the chart coin: BSL n (number of BSL waves with that role), Fell (share of them after which the close was lower), SSL n and Rose (the same for SSL waves).
- Any candle: the baseline row, what price did after an arbitrary candle. Over all closed candles on which at least one basket coin had data, the share of candles whose close was lower (Fell column) and the share whose close was higher (Rose column) than the close 12 candles earlier. Compare each role's percentage with this row.
- Bottom line: open windows, if any ("BSL live 5" with the position inside the window), the number of waves in the loaded history (including waves whose outcome is still pending), the number of coins with data out of the basket on the last candle, and the note that these are historical statistics, not a forecast.

ALERTS
All alerts fire at candle close, at the END of the window, that is 5 candles after the first sweep, and only for waves with at least 10 coins. They use the live count (see Realtime behaviour).
- "Any alert() function call": one message per candle, for example "High-sweep wave: 12 of 20 coins | BTCUSDT.P 240"; if both sides end on the same candle the message has two lines.
- Two alert conditions, "High-sweep wave ended" and "Low-sweep wave ended", with the message "High-sweep wave ended on <ticker> <interval>" (same for low).
- Use one way or the other; if you create both, you get two messages for the same wave.

HOW TO READ IT
- A mark tells you that at least 5 coins took the same side of their pools within 6 candles; the tooltip tells you who went first.
- The table tells you how often, on this chart and timeframe, the close was lower 12 candles after a BSL wave or higher after an SSL wave, split by whether this coin led, joined or stayed out. Read it against the Any candle row.
- The counts are small and the outcome windows of neighbouring waves overlap, so the waves are not independent samples. With about 150 waves in a table row the 95% margin of a share near 50% is roughly 8 percentage points either way, so a difference of a few points from the baseline does not show anything by itself.
- This is context for your own analysis, not an entry signal.

INPUTS (defaults; all inputs are hidden from the status line)
- Pool length (candles): 20
- Wave window (candles): 6
- Min coins in a wave: 5
- Outcome horizon (candles): 12
- Alert: min coins in a wave: 10
- Basket coins (max 20): the list above, comma separated
- Show wave marks: on
- Table position: Top right

REALTIME BEHAVIOUR AND LIMITS
- Every decision is taken on closed candles. On the closing tick of a chart candle the other coins' candles may not have their final values yet, or may not be matched in time, and such a coin is not counted on that candle. The live count of a wave can therefore differ from the count the script gets when it recalculates the history, and after a chart reload the newest marks, their size, the alerts that would have fired and the table can change.
- Marks on the chart: up to 200 labels in total, the live label included, so only the most recent waves are marked. The table counts every wave in the loaded history, so its numbers depend on the timeframe and on how many candles your plan loads.
- The basket is requested from the chart's exchange. On an exchange without USDT perpetuals the bottom line shows 0/20 coins and no waves are found. On a spot chart the basket is still read from the perpetuals while the chart coin's own role comes from the spot candles.
- Up to 20 coins are read on every candle; loading can be slow on very small timeframes with long history.
- Built for standard candles. Heikin Ashi, Renko and other synthetic charts change the prices the script reads.
- Colours switch automatically with the chart background (light or dark).

Not financial advice.

免責聲明

這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。