OPEN-SOURCE SCRIPT
Sweep Hour Heatmap [Zen]

Sweep Hour Heatmap [Zen] counts liquidity sweeps by the hour of the week in which they happened and shows how often the sweeps of each hour were followed by a reversal. Every sweep of a basket of up to 20 crypto perpetuals (or of the chart coin alone) is placed in one of 168 cells, weekday x UTC hour, by the open time of the sweep candle. 6 candles later the script compares the close with the close of the sweep candle: lower after a high sweep, or higher after a low sweep, counts as a reversal. A 7 x 24 table shows the number of sweeps in every cell and fills in orange the cells whose reversal share is at least 5 points above the share of all sweeps together, so you can see in which hours, on this exchange and history, sweeps were most often followed by a reversal.
The script works on the 1H chart only. All numbers below are default settings and can be changed in Inputs.
WHAT IS DIFFERENT HERE
Pool and sweep detection and basket requests are the same building blocks as in my other open-source scripts; what this script does with the sweeps is its own:
- every sweep goes into a weekday x hour cell, and the cell keeps the number of sweeps and the number of reversals after them;
- the reversal is defined on the sweep candle's own close, a fixed number of candles later, the same way for every coin and every cell;
- the fill of a cell is relative: it shows how far the cell's reversal share is above the share of all counted sweeps, in four steps, and a cell with too few sweeps is never filled;
- the alert fires when the chart coin sweeps a pool in an hour whose cell is above the average by a set margin.
It is not a version of Session Sweep Map [Zen], which draws the highs and lows of the Asia, London and New York sessions on one coin and records which session swept whose level: there are no session levels and no lines here. Liquidity Sweep Breadth [Zen] measures how many basket coins swept on one candle, in a lower pane: this script has no lower pane and no per-candle count. Sweep Lead Lag [Zen] groups sweeps into waves and records the chart coin's role; Sweep Volume Shock [Zen] classifies sweeps by the volume of the sweep candle. None of them has a weekday x hour axis, and this script has no session levels, waves or volume classes. Unlike typical time-of-day statistics of returns per hour, the unit here is a sweep and the measure is what happened after it.
HOW IT WORKS
- Timeframe: 1H only. On any other timeframe the table shows "Use the 1H chart" and nothing is counted.
- Basket: BTC, ETH, SOL, XRP, BNB, DOGE, ADA, LINK, AVAX, LTC, SUI, NEAR, AAVE, ONDO, DOT, TRX, BCH, UNI, APT, ARB (comma separated, no trailing comma; only the first 20 are used). Each coin is requested as the chart's exchange + coin + USDT.P on 1H, 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. With "Count sweeps of" set to Chart coin, only the chart's own sweeps are counted; the basket is still requested, so loading takes the same time.
- 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). A candle that sweeps both pools counts as two sweeps, one per side.
- Cell: the weekday and the UTC hour of the open time of the sweep candle, 7 days x 24 hours = 168 cells. Monday 00:00 UTC is the first cell, Sunday 23:00 UTC the last.
- Reversal: 6 closed candles after the sweep candle, the close of the same coin is compared with the close of the sweep candle. After a high sweep the sweep is a reversal if the later close is lower; after a low sweep, if it is higher. An equal close is not a reversal. A sweep is added to its cell only when this check is done, so the sweeps of the last 6 candles are not in the table yet. If the coin has no candle at the moment of the check, the sweep is dropped and counted nowhere.
- History: only sweeps within the last 2000 candles of the chart are counted (see Realtime behaviour).
- Average share: the number of reversals divided by the number of counted sweeps, over all cells together. It is the share of all sweeps, not the mean of the 168 cells, so cells with many sweeps weigh more.
- Edge of a cell: the cell's reversal share minus the average share, in percentage points. A cell with fewer than 15 sweeps has no edge: it is shown in grey and is never filled or starred.
WHAT YOU SEE
- Table (top right by default): 7 rows Mon to Sun, 24 columns 00 to 23 UTC. Header: the number of coins with data out of the basket (or the chart symbol in Chart coin mode), the time zone, the reversal horizon and the minimum sweeps per cell.
- Cell: the number of sweeps, or "-" when there are none. No fill when the edge is below +5 points or the cell has fewer than 15 sweeps. Four steps of orange for an edge of at least +5, +10, +20 and +30 points; the last step has inverted text. The cell with the highest edge among the cells with at least 15 sweeps has a star after its number. Tooltip: weekday and hour, sweeps and reversal share; the edge only for cells with at least 15 sweeps.
- Legend row: the average share and the four fill steps.
- Bottom line: counted sweeps, average reversal share, the top cell with its share and count, the history length, and a note that these are historical data, not a forecast.
- Nothing is drawn on the candles.
ALERTS
Evaluated on the close of every 1H candle. The alert() message already fires once per bar close; for the alert condition choose the frequency "Once per bar close".
- "Any alert() function call": one message when the chart coin sweeps a pool (high or low) in an hour whose cell has at least 15 sweeps and an edge of at least +10 points over the average, for example "Sweep in a hot hour: BTCUSDT.P 60 | 03:00 UTC | 14/15 reversals".
- One alert condition, "Sweep in a hot hour", with the message "Sweep in a hot hour on <ticker> <interval>".
- Use one of the two ways; if you create both, you get two messages for the same event.
- The alert reports the chart coin's sweep and the cell's statistics as they stand at that moment. It does not say that this sweep will reverse.
HOW TO READ IT
- A filled cell says that, on the loaded history of this exchange, sweeps in that hour were followed by a reversal more often than sweeps in general. The darker the fill, the larger the difference.
- With 168 cells, some look hot by chance alone: with a few dozen sweeps per cell the reversal share of one cell moves by about 20 percentage points from chance, and with no real hour effect the top cell typically sits about 25 points above the average while some 30 cells reach the first fill step. Sweeps of different coins on the same candle are not independent, so the real sample is smaller than the number shown. Treat a filled cell or the star as a place to look, to be checked on more history, other exchanges or other coins, not as a rule.
- Chart coin mode has about one sweep per cell over 2000 candles; with the default minimum expect nearly every cell to be grey.
- 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
- Reversal check (candles): 6
- History (candles): 2000
- Count sweeps of: Basket
- Basket coins (max 20): the list above
- Min sweeps for a cell to count: 15
- Hot hour: edge over average (pp): 10
- Table position: Top right
REALTIME BEHAVIOUR AND LIMITS
- The history window is set when the chart loads: it is counted back from the last candle at that moment. While the chart stays open new sweeps are added and old ones are not removed, so the window grows until the next reload.
- 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. After a reload the window moves to the new last candle, so the counts, the average share, the fills, the starred cell and the hot status of a cell can change; an alert that fired live may not match the reloaded table. The chart coin's own sweep is final on a closed candle.
- The table counts the loaded history only, so its numbers depend on how many candles your plan loads; with fewer than 2000 candles loaded the window is shorter than the setting.
- The basket is requested from the chart's exchange. On an exchange without USDT perpetuals the header shows 0/20 coins and the table has no counts. On a spot chart the chart coin's sweeps are spot while the basket is read from the perpetuals.
- Up to 20 coins are read on every candle; the first load can take a few seconds.
- Built for standard candles. Heikin Ashi, Renko and other synthetic charts change the prices the script reads.
- Colours follow the chart background (light or dark).
Not financial advice.
The script works on the 1H chart only. All numbers below are default settings and can be changed in Inputs.
WHAT IS DIFFERENT HERE
Pool and sweep detection and basket requests are the same building blocks as in my other open-source scripts; what this script does with the sweeps is its own:
- every sweep goes into a weekday x hour cell, and the cell keeps the number of sweeps and the number of reversals after them;
- the reversal is defined on the sweep candle's own close, a fixed number of candles later, the same way for every coin and every cell;
- the fill of a cell is relative: it shows how far the cell's reversal share is above the share of all counted sweeps, in four steps, and a cell with too few sweeps is never filled;
- the alert fires when the chart coin sweeps a pool in an hour whose cell is above the average by a set margin.
It is not a version of Session Sweep Map [Zen], which draws the highs and lows of the Asia, London and New York sessions on one coin and records which session swept whose level: there are no session levels and no lines here. Liquidity Sweep Breadth [Zen] measures how many basket coins swept on one candle, in a lower pane: this script has no lower pane and no per-candle count. Sweep Lead Lag [Zen] groups sweeps into waves and records the chart coin's role; Sweep Volume Shock [Zen] classifies sweeps by the volume of the sweep candle. None of them has a weekday x hour axis, and this script has no session levels, waves or volume classes. Unlike typical time-of-day statistics of returns per hour, the unit here is a sweep and the measure is what happened after it.
HOW IT WORKS
- Timeframe: 1H only. On any other timeframe the table shows "Use the 1H chart" and nothing is counted.
- Basket: BTC, ETH, SOL, XRP, BNB, DOGE, ADA, LINK, AVAX, LTC, SUI, NEAR, AAVE, ONDO, DOT, TRX, BCH, UNI, APT, ARB (comma separated, no trailing comma; only the first 20 are used). Each coin is requested as the chart's exchange + coin + USDT.P on 1H, 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. With "Count sweeps of" set to Chart coin, only the chart's own sweeps are counted; the basket is still requested, so loading takes the same time.
- 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). A candle that sweeps both pools counts as two sweeps, one per side.
- Cell: the weekday and the UTC hour of the open time of the sweep candle, 7 days x 24 hours = 168 cells. Monday 00:00 UTC is the first cell, Sunday 23:00 UTC the last.
- Reversal: 6 closed candles after the sweep candle, the close of the same coin is compared with the close of the sweep candle. After a high sweep the sweep is a reversal if the later close is lower; after a low sweep, if it is higher. An equal close is not a reversal. A sweep is added to its cell only when this check is done, so the sweeps of the last 6 candles are not in the table yet. If the coin has no candle at the moment of the check, the sweep is dropped and counted nowhere.
- History: only sweeps within the last 2000 candles of the chart are counted (see Realtime behaviour).
- Average share: the number of reversals divided by the number of counted sweeps, over all cells together. It is the share of all sweeps, not the mean of the 168 cells, so cells with many sweeps weigh more.
- Edge of a cell: the cell's reversal share minus the average share, in percentage points. A cell with fewer than 15 sweeps has no edge: it is shown in grey and is never filled or starred.
WHAT YOU SEE
- Table (top right by default): 7 rows Mon to Sun, 24 columns 00 to 23 UTC. Header: the number of coins with data out of the basket (or the chart symbol in Chart coin mode), the time zone, the reversal horizon and the minimum sweeps per cell.
- Cell: the number of sweeps, or "-" when there are none. No fill when the edge is below +5 points or the cell has fewer than 15 sweeps. Four steps of orange for an edge of at least +5, +10, +20 and +30 points; the last step has inverted text. The cell with the highest edge among the cells with at least 15 sweeps has a star after its number. Tooltip: weekday and hour, sweeps and reversal share; the edge only for cells with at least 15 sweeps.
- Legend row: the average share and the four fill steps.
- Bottom line: counted sweeps, average reversal share, the top cell with its share and count, the history length, and a note that these are historical data, not a forecast.
- Nothing is drawn on the candles.
ALERTS
Evaluated on the close of every 1H candle. The alert() message already fires once per bar close; for the alert condition choose the frequency "Once per bar close".
- "Any alert() function call": one message when the chart coin sweeps a pool (high or low) in an hour whose cell has at least 15 sweeps and an edge of at least +10 points over the average, for example "Sweep in a hot hour: BTCUSDT.P 60 | 03:00 UTC | 14/15 reversals".
- One alert condition, "Sweep in a hot hour", with the message "Sweep in a hot hour on <ticker> <interval>".
- Use one of the two ways; if you create both, you get two messages for the same event.
- The alert reports the chart coin's sweep and the cell's statistics as they stand at that moment. It does not say that this sweep will reverse.
HOW TO READ IT
- A filled cell says that, on the loaded history of this exchange, sweeps in that hour were followed by a reversal more often than sweeps in general. The darker the fill, the larger the difference.
- With 168 cells, some look hot by chance alone: with a few dozen sweeps per cell the reversal share of one cell moves by about 20 percentage points from chance, and with no real hour effect the top cell typically sits about 25 points above the average while some 30 cells reach the first fill step. Sweeps of different coins on the same candle are not independent, so the real sample is smaller than the number shown. Treat a filled cell or the star as a place to look, to be checked on more history, other exchanges or other coins, not as a rule.
- Chart coin mode has about one sweep per cell over 2000 candles; with the default minimum expect nearly every cell to be grey.
- 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
- Reversal check (candles): 6
- History (candles): 2000
- Count sweeps of: Basket
- Basket coins (max 20): the list above
- Min sweeps for a cell to count: 15
- Hot hour: edge over average (pp): 10
- Table position: Top right
REALTIME BEHAVIOUR AND LIMITS
- The history window is set when the chart loads: it is counted back from the last candle at that moment. While the chart stays open new sweeps are added and old ones are not removed, so the window grows until the next reload.
- 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. After a reload the window moves to the new last candle, so the counts, the average share, the fills, the starred cell and the hot status of a cell can change; an alert that fired live may not match the reloaded table. The chart coin's own sweep is final on a closed candle.
- The table counts the loaded history only, so its numbers depend on how many candles your plan loads; with fewer than 2000 candles loaded the window is shorter than the setting.
- The basket is requested from the chart's exchange. On an exchange without USDT perpetuals the header shows 0/20 coins and the table has no counts. On a spot chart the chart coin's sweeps are spot while the basket is read from the perpetuals.
- Up to 20 coins are read on every candle; the first load can take a few seconds.
- Built for standard candles. Heikin Ashi, Renko and other synthetic charts change the prices the script reads.
- Colours follow the chart background (light or dark).
Not financial advice.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Open-source: Untouched Levels [Zen] → tradingview.com/script/9cwR0ZIw-Untouched-Levels-Zen/ | Free: Liquidity Zones [Zen] → tradingview.com/script/aSdm5wX3-Liquidity-Zones-Zen/
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Open-source: Untouched Levels [Zen] → tradingview.com/script/9cwR0ZIw-Untouched-Levels-Zen/ | Free: Liquidity Zones [Zen] → tradingview.com/script/aSdm5wX3-Liquidity-Zones-Zen/
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.