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

Taught to TradeSystems over signals.

Explainers / Support and Resistance Levels with Break

Support and Resistance Levels with Breaks [LuxAlgo], explained from the source

Support and Resistance Levels with Breaks is an open-source TradingView script by LuxAlgo (about 67,000 boosts). It draws a red line at the latest swing high and a blue line at the latest swing low, and prints a label when the close crosses one of them. This page walks through what the published code does, what each of its four settings changes, and where it fails. It does not say what price does after a label.

The surprise: "B" is the rare label, and it is gated by two tests the name does not mention

A break here is not just a close across a line. The plain "B" label needs three things at once: the close crosses the level, the candle's wick is not bigger than its body (a test on the open, high, low and close of that bar), and a volume test passes. If the cross happens but the wick test fails, the script prints a different label, "Bull Wick" or "Bear Wick", and that label has no volume test at all. So the script has two kinds of break label with different rules, and the one named "B" is the stricter one.

Step 1: the levels are single pivots, known 16 bars late

The script finds a swing high when a bar's high is the highest among the 15 bars before it and the 15 bars after it (Left Bars and Right Bars, both 15 by default). The low side works the same way. A pivot needs 15 bars on the right to exist, and the script then reads it one bar later, so a level is only known 16 bars after the bar it sits on. The level is that one pivot's high (or low), held flat until the next pivot on that side replaces it. There is no zone and no count of how many times price touched it.

Step 2: the line is drawn back in time

The plotted lines are shifted 16 bars into the past, so each one appears to start at the pivot bar, even though the script only knew about it 16 bars later. Unlike some scripts, there is no setting to switch this off. The label test, though, uses the level as it was known on the current bar, so the line you see and the level the test used are the same number, but the line's start looks earlier than the script's knowledge. A gap is left in the line on the bar where the level changes.

Step 3: the break test

On each bar, a cross up means the close is above the resistance level and the previous close was at or below it; a cross down is the mirror against the support level. The script does not wait for the bar to close: on a live bar the current price is the close, so a label can appear and then vanish before the bar finishes.

Step 4: the volume test

The volume test is a percent difference between two averages of volume: a 5-bar exponential average and a 10-bar exponential average. The "Volume Threshold" of 20 means the short average must be more than 20 percent above the long one. It is not a volume amount. It compares recent volume with slightly older volume, so a quiet market that just woke up passes and a busy market that stays busy does not. On a symbol with no volume data the test cannot pass, so "B" labels do not appear, while the wick labels still can.

Step 5: the wick labels

If a cross up happens on a bar whose distance from the open down to the low is larger than the distance from the open up to the close, the label is "Bull Wick" and the volume test is skipped. The cross-down side compares the upper wick to the body the same way and prints "Bear Wick". Because the comparison uses the open, an upward cross on a bar that gapped up and closed below its open also lands in the "Bull Wick" bucket. So "Bull" and "Bear" describe which test the candle failed, not where price went next.

Step 6: the alerts are not the labels

The two alert conditions, "Support Broken" and "Resistance Broken", use only the cross and the volume test. They ignore the "Show Breaks" setting and the wick test. So an alert can fire on a bar that has no label because labels are switched off, and a "Bull Wick" label can print with no alert if volume did not pass.

What the settings change (synthetic prices, seeds 1 to 3)

On random prices with no structure, the 15/15 default produced about 2 level changes per 100 bars per side, so the level moves roughly every 50 bars. Left and Right at 7 doubled that to about 4.2; at 30 it halved to about 1. With the volume test switched off, the close crossed a level about once per 100 bars per side. At the default threshold, the test passed on only about 2 percent of bars in this made-up volume, so "B" labels were almost absent and the wick labels, which skip the test, were the more common of the two in 5 of 6 side-and-seed counts. Real volume clusters, so on real charts the test passes more often. These are counts on invented data: they show how the code behaves, not whether a label means anything.

Where it fails

Also explained: Trendlines with Breaks · Support and Resistance Channels · Pivot Points High Low · Order Block Finder · Market Structure Break & Order Block

Educational only. Not financial advice. Nothing here is a recommendation to buy or sell anything. Support and Resistance Levels with Breaks [LuxAlgo] is by LuxAlgo on TradingView, published under CC BY-NC-SA 4.0; 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, 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 , Support and Resistance (High Volume Boxe, 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.