Free: indicator teardowns, a repaint checker and open-source scripts. No buy/sell signals, ever.

Taught to TradeSystems over signals.

Explainers / Support and Resistance (High Volume Boxe

Support and Resistance (High Volume Boxes) by ChartPrime, explained from the source

Support and Resistance (High Volume Boxes) is an open-source TradingView script by ChartPrime, about 46,300 boosts, last updated in June 2024. On the chart it is called "SR Breaks and Retests". It draws green and red boxes at turning points, shades them by volume, marks "holds" with small diamonds and prints "Break Sup" and "Break Res" labels. This page walks through its published code in order, says what each part does, and ends with where it fails. It does not say what any box or mark will do next.

The surprise: the volume on the box is not the volume at the level

The description says the boxes come from pivot points and volume. In the code, the volume test is made on the bar that confirms the pivot, which with the default setting is the bar 20 bars after the turning point. The "Vol:" number printed in the box is that later bar's volume, not the volume traded at the level. So a box does not tell you that heavy volume met price at that price.

Step 1: the turning points

The script looks for a pivot low and a pivot high in the closing price, not in the wicks. A pivot low is a close lower than the 20 closes before it and the 20 closes after it (the "Lookback Period", default 20). A turning point can only be confirmed 20 bars later, because the script needs those 20 later closes to exist. On a live chart the box therefore appears 20 bars after the turn, and is drawn starting back at the turn.

Step 2: what "volume" means here

Each bar gets a signed volume: its volume counted as positive if it closed above its open, negative if it closed below. A bar that closed exactly at its open takes the sign of the last bar that did not. The function is named as a delta volume, but its two running totals are reset to zero on every bar, so the result is simply the current bar's volume with a plus or minus sign. Nothing is added up across bars.

Step 3: the filter that keeps a box

A support box is kept when a pivot low is confirmed and the signed volume of the confirming bar is above the higher of its own value and the previous bar's value, each divided by 2.5. With the default length of 2, that test passes whenever the confirming bar closed up and its volume beats 40% of the previous bar's volume, and it always passes when the previous bar closed down. A resistance box needs the mirror image: a pivot high and a confirming bar that closed down. In practice the filter mostly asks one question: did the bar 20 bars after the turn close in the right direction?

Step 4: the boxes

A support box runs from the pivot's close down by one 200-bar Average True Range (times "Adjust Box Width", default 1). A resistance box runs from the pivot's close up by the same amount. Its left edge is at the turning point and it keeps stretching right until a new box of the same colour replaces it. The shade comes from the confirming bar's volume compared with the largest signed volume of the last 25 bars. Because of the 200-bar ATR, boxes cannot get a height until 200 bars of history exist.

Step 5: holds, breaks and labels

A support "hold" is the bar where the low crosses back above the top of the support box. A support "break" is the bar where the high crosses below the bottom of the box; the box then turns red with a dashed border, and on the first such break a "Break Sup" label is placed on the previous bar. Resistance is the mirror image. Once a box has been broken and not yet held, the next break in the same direction gets a diamond for the old level holding in its new role instead of a label. All four diamond plots are drawn with an offset of minus one, so each diamond sits on the bar before the one where its condition became true.

What the settings change

"Lookback Period" (20) sets how many closes on each side make a pivot, and so how late each box appears. "Delta Volume Filter Length" (2) is the window for the volume test; a larger number drops more boxes. "Adjust Box Width" (1) multiplies the 200-bar ATR used for box height. The ATR length of 200, the divisor of 2.5 and the 25-bar shading window are fixed in the code and are not settings.

What we checked in Python

We ported the box-making logic to Python and ran it on invented random-walk prices, with volume drawn at random and with no link to price direction (20,000 bars, three seeds). With the default settings, 46% to 53% of the pivots became boxes, about 15 boxes per 1,000 bars. The pivots that became boxes had their own bar volume at 1.01 to 1.04 times the average pivot, so the filter did not pick out turning points where more volume traded. The confirming bars of kept boxes had 0.88 to 1.09 times the volume of the confirming bars of dropped ones. Raising the filter length to 10 kept 29% to 35% of pivots and the confirming bars' volume rose to 1.2 to 1.4 times, but the turning points' own volume stayed at 0.97 to 1.04 times average. These figures describe the code on invented data, not any market.

Where it fails

Educational only. Not financial advice. Nothing here is a recommendation to buy or sell anything. Support and Resistance (High Volume Boxes) is by ChartPrime on TradingView and carries a Mozilla Public License 2.0 notice; this page describes its published open-source code in our own words and is not affiliated with the author. Simulation figures come from synthetic random-walk prices and say nothing about how the script trades.

Also explained: Repaint checker, VWAP, Supertrend, RSI, UT Bot Alerts, Nadaraya-Watson Envelope, Squeeze Momentum, What is repainting on TradingView?, Is TradingView backtesting accurate?, Chandelier Exit, WaveTrend Oscillator, QQE MOD, Pivot highs and lows, Hull Suite, Range Filter, Twin Range Filter, HalfTrend, ZigZag++, SSL Hybrid, CM MacD Ultimate MTF, Volume Profile / Fixed Range, ADX and DI, Support Resistance Channels, Market Structure Break & Order Block, Order Block Finder, Pivot Point SuperTrend, Trendlines with Breaks [LuxAlgo], Divergence for Many Indicators, TradingView script selling terms, Support and Resistance Levels with Break, Liquidity Swings [LuxAlgo], Pine Script errors, Breakout Probability (Expo), Did ChatGPT or Claude write your Pine Sc, Lorentzian Classification, SuperTrend AI (Clustering), Machine Learning Adaptive SuperTrend, Dynamic Swing Anchored VWAP, Support and Resistance Power Channel by , Trendline Breakouts With Targets by Char, Breakout Finder by LonesomeTheBlue

Next steps

  • Get a script fixed. Compiles but behaves differently live, or changes after a reload? In a Pine Script Audit, an AI model reads every line and writes a report on what to fix for $49, or also fixes those problems for $149. It cannot prove a script is safe.
  • Check your own script. Paste its source into the free repaint checker. It runs in your browser and flags known patterns.
Subscribe to the Teardown Letter: $19/moBack to Taught to Trade

No TradingView account yet? This affiliate link gives you a $15 coupon toward a paid plan, and we earn a commission if you buy one. The free plan is enough to follow this page.