OPEN-SOURCE SCRIPT
Fault Lines

FAULT LINES
Fault Lines marks the price bands where resting orders accumulate, then tracks what actually happens to each band: whether price pierced it and was rejected, or closed through it. Those two outcomes point in opposite directions, and the script separates them everywhere — in colour, in the marker it draws, in the state it stores and in the alert it fires.
THE IDEA BEHIND IT
A confirmed swing high is a price the market refused to trade above for a number of bars on both sides. Stop orders from short positions, and buy stops from breakout traders, collect just above it. A confirmed swing low collects the mirror image below it. Those pockets are the reason price frequently accelerates through an old extreme and then immediately reverses.
What matters is not that a level exists, but what price did when it arrived there. Two outcomes are possible and they mean different things:
HOW THE COMPONENTS WORK TOGETHER
The script uses three market measurements. They are not three indicators shown next to each other — each one answers a different question about the same object, and none of them is plotted on its own:
Remove any one of them and the remaining logic stops working: without structure there is no band, without ATR the band cannot be sized or compared across symbols, without volume the score cannot distinguish a level built on real participation from one built on a quiet drift.
HOW IT WORKS, STEP BY STEP
READING THE CHART
HOW TO USE IT
Bands are context, not entries. Three practical readings:
Set Structure Length to control granularity: leave it at 0 to adapt to the timeframe, raise it for fewer and more significant levels. If the chart feels crowded, raise Minimum Strength to 40–50 before touching anything else.
REPAINTING
A band is drawn Structure Length bars after the pivot that created it, because that is when the pivot becomes confirmable. That is confirmation delay, not repainting: once placed, a band never changes its price and never disappears retroactively. With Confirm On Bar Close enabled — the default — every state change is evaluated on closed bars only. Disabling it lets states react during the forming bar, which flickers until that bar closes.
LIMITATIONS
ALERTS
Open source. Written from scratch; no third-party code is reused.
Fault Lines marks the price bands where resting orders accumulate, then tracks what actually happens to each band: whether price pierced it and was rejected, or closed through it. Those two outcomes point in opposite directions, and the script separates them everywhere — in colour, in the marker it draws, in the state it stores and in the alert it fires.
A level that is pierced and rejected is a reversal footprint. A level that is closed through is a continuation footprint. Most tools call both of them "broken" and delete the box.
THE IDEA BEHIND IT
A confirmed swing high is a price the market refused to trade above for a number of bars on both sides. Stop orders from short positions, and buy stops from breakout traders, collect just above it. A confirmed swing low collects the mirror image below it. Those pockets are the reason price frequently accelerates through an old extreme and then immediately reverses.
What matters is not that a level exists, but what price did when it arrived there. Two outcomes are possible and they mean different things:
- The wick trades through the level and the bar closes back inside — the orders were filled and the move was rejected.
- The bar closes beyond the level — the level no longer holds and structure has changed.
HOW THE COMPONENTS WORK TOGETHER
The script uses three market measurements. They are not three indicators shown next to each other — each one answers a different question about the same object, and none of them is plotted on its own:
- Swing structure answers where a band belongs. A pivot is confirmed only when a set number of bars on both sides failed to exceed it.
- ATR answers how thick the band should be and how far away is far. A fixed percentage would make bands unusable across instruments with different volatility, so band height, merge distance and retirement distance are all expressed in ATR(100).
- Volume answers how much was transacted while the band was built. It feeds the strength score only. It never creates or suppresses a band by itself.
Remove any one of them and the remaining logic stops working: without structure there is no band, without ATR the band cannot be sized or compared across symbols, without volume the score cannot distinguish a level built on real participation from one built on a quiet drift.
HOW IT WORKS, STEP BY STEP
- Band creation. A pivot is confirmed Structure Length bars after it printed. ATR(100) is read at that bar and a band of ATR × Zone Height is placed around the pivot, distributed 80% beyond the extreme and 20% inside it, because the orders sit beyond the wick rather than centred on it.
- Merging. If the new pivot lands within Merge Distance × ATR of an existing band on the same side, no second band is created. The existing one is stretched to cover both extremes, its level moves to the more extreme of the two, and its retest counter increments. This is what keeps a range from producing a dozen near-identical boxes.
- Lifecycle. On every closed bar each band is evaluated in a fixed order. For an upper band: it is ruptured if close is above the level; otherwise swept if the high is above the level but the close is not; otherwise tested if the high reached into the band; otherwise it stays intact. Lower bands use the mirrored conditions on low and close. Rupture is checked before sweep, so a bar that closes through is never counted as a rejection.
- Strength score, 0 to 100. Three components: volume on the pivot bar divided by its 50-bar average, capped at 2x, worth 35 points; the height of the swing leg into the pivot divided by ATR, capped at 3 ATR, worth 40 points; and the number of separate returns into the band, capped at 3, worth 25 points. A newly created band can therefore reach 75 — the remaining 25 points are earned over time. The score drives fill opacity and line weight, so a glance is enough to rank the levels.
- Relevance and pruning. When a side reaches its band limit the script does not drop the oldest band, it drops the least relevant one. Relevance is the strength score minus a distance penalty (up to 45 points, scaled over 12 ATR) and an age penalty (up to 25 points, scaled over 400 bars). Without this, a single very prominent old extreme keeps its slot indefinitely while newer levels near price are discarded.
- Retirement. Independently of pruning, a band is removed once price has moved further than the configured ATR distance from it, or once it exceeds the configured age. Zone Lifespan sets both at once: Short is 200 bars / 8 ATR, Medium 400 / 15, Long 800 / 25, or Unlimited.
READING THE CHART
- Band opacity — brightness tracks strength; bands dim with age and brighten again as price approaches.
- Level line — solid while intact, dotted once tested, dashed once swept.
- Triangle marker — a sweep: wick through, close back inside.
- Faded band with a dashed outline — a ruptured level, frozen at the bar it gave way, kept as a record of where structure changed.
- Vertical tick on the left of a band — the pivot that created it.
- Dotted beam — distance from price to the nearest live band, in percent.
- Dashboard — bands above and below, sweeps and ruptures on screen, nearest level and its distance, average strength, and which side currently holds more unfilled levels.
HOW TO USE IT
Bands are context, not entries. Three practical readings:
- Approach. An intact band with a high score is a place where a move is likely to stall or accelerate. The dashboard's nearest-level row tells you how much room is left before you get there.
- Sweep. A sweep marker on a strong band says the orders behind it were taken and price refused to hold beyond it. Traders using reversal setups take this as a location filter; it says nothing about timing on its own.
- Rupture. A close through a strong band is the opposite message. Ruptures accumulate in the direction structure is breaking, which is often clearer than the candles themselves.
Set Structure Length to control granularity: leave it at 0 to adapt to the timeframe, raise it for fewer and more significant levels. If the chart feels crowded, raise Minimum Strength to 40–50 before touching anything else.
REPAINTING
A band is drawn Structure Length bars after the pivot that created it, because that is when the pivot becomes confirmable. That is confirmation delay, not repainting: once placed, a band never changes its price and never disappears retroactively. With Confirm On Bar Close enabled — the default — every state change is evaluated on closed bars only. Disabling it lets states react during the forming bar, which flickers until that bar closes.
LIMITATIONS
- Symbols without volume data score every band on prominence alone, so the volume component contributes nothing there.
- On very short structure lengths in a tight range, sweeps and retests occur constantly and the score saturates. Raise the structure length rather than the band count.
- The script describes where orders are likely to rest. It does not predict direction and produces no entry or exit signals.
ALERTS
- New Fault — a band was created.
- Fault Swept — includes side, price and strength.
- Fault Ruptured — includes side and price.
Open source. Written from scratch; no third-party code is reused.
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.
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.
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.