OPEN-SOURCE SCRIPT
更新済 Support & Resistance Confluence Levels, Hold Record & Reversal

OVERVIEW
Four lines. Two above price, two below. That is the whole chart.
Every other support/resistance tool has the opposite problem. It finds forty levels and leaves you to work out which two matter. Forty levels is not information, it is wallpaper — and a level you have to hunt for is a level you will not trade.
So this tool inverts the design. It does not ask "where are the levels?" It asks:
WHICH LEVEL WOULD I ACTUALLY TRADE, RIGHT NOW, AND WHY SHOULD I BELIEVE IT?
A price is only promoted to a level when SEVERAL INDEPENDENT METHODS AGREE ON IT. One method finding a level proves nothing — every method finds levels everywhere. The signal is AGREEMENT.
This is a research and framing tool. It is NOT a strategy, NOT a signal service, and NOT a validated edge.
THE SIX VOICES — four propose, two confirm
PROPOSERS. Each nominates candidate prices, independently:
◆ SWING PIVOT the classic. Where price actually turned.
~ KERNEL EXTREMUM the turning point of the SMOOTHED price (Nadaraya-Watson), which is the shape
rather than the noise. This is Lo, Mamaysky and Wang's method, and it finds
structurally different levels from a raw pivot. That independence is exactly
what makes agreement between the two worth something. Agreement between two
methods that make the same mistakes is worth nothing at all.
⇈ HIGHER TIMEFRAME a swing on the HTF. The level a bigger participant is watching.
▣ PRIOR PERIOD yesterday's high and low. Last week's high and low. The most watched prices on
any chart — and missing from almost every auto-S/R script on TradingView.
CONFIRMERS. They do not nominate, they vouch:
▪ VOLUME NODE the level sits where volume actually transacted. Real business was done here,
not merely a turning point.
○ ROUND NUMBER the psychological grid.
Candidates within an ATR tolerance merge, and the merged level inherits every voice that spoke for it. A level needs MIN VOICES to exist at all. Everything below that is DISCARDED, not hidden. Then only the nearest two above and two below are drawn.
The label tells you why the level is there: "◆~▣▪ 4v held 3/4 24,247.00" — four independent voices, tested four times, held three.
AND THEN THE PART NOBODY DOES: WE TEST WHETHER CONFLUENCE ACTUALLY RANKS
"Levels are stronger when several methods agree" is one of the most repeated claims in technical analysis and almost nobody has ever checked it. It is checkable. So the panel reports:
High confluence (3+) +0.24R n=61 PROVEN
Low confluence -0.03R n=88
Control (unconditional) +0.02R n=240
DOES CONFLUENCE RANK? YES — more voices IS better
And the control is DIRECTION-MATCHED. Reversals at support are overwhelmingly LONG on a drifting index — and a long-biased event set compared against a 50/50 control is handed the drift for free and calls it an edge. Longs are compared only with control longs, shorts only with control shorts, and the control is then blended back using the events' OWN direction mix. It is a subtle trap and it will manufacture an edge out of nothing if you let it.
And the verdict is a TEST, not a comparison. High confluence is measured against low confluence with a Welch t-test, and the difference must clear |t| > 1.96 before it is allowed to be a finding. Below that, the panel prints the least satisfying answer there is — NO DIFFERENCE — because that is the honest one. A tool that reports a 0.02R gap as a verdict is not measuring anything, it is decorating.
If the extra voices do not rank on your instrument, then on your instrument they do not rank, and no amount of agreement between methods will change that. That row is the reason this script exists.
THE HOLD RECORD — and why "held 3/4" is not what most scripts mean by it
A TEST IS AN EPISODE, NOT A BAR. Price arrives at the level and the test stays OPEN until price LEAVES it — back the way it came (HELD) or straight through (BROKE). A bar that closes INSIDE the zone has resolved nothing and is counted as nothing.
Counting every touching bar as a completed test drops an entire consolidation into the denominator as failures, and manufactures hold rates near 10% that say nothing about the level and everything about the counter. An unresolved test is neither a hold nor a break, exactly as an unresolved trade is neither a win nor a loss.
AND A TEST IS AN APPROACH, NOT A BAR TOUCHING A BOX. Price exits the zone (HELD), the next bar dips straight back in — and without a re-arm rule that counts as a brand-new test. Chop sitting on a level then logs a hundred "tests" that were really one event. Measured live before this was fixed: 224 tests of a single level on a 5m chart, and hold rates that all landed between 61% and 75% no matter which level you looked at. A statistic that cannot tell any two levels apart is not measuring the levels — it is measuring the bar size. Price must now travel clear of the zone before the level can be tested again. One approach, one test.
The volume filter gates the SIGNAL and never the RECORD. A level that holds on thin volume still HELD. Quietly dropping it from the numerator while leaving it in the denominator is how a hold rate gets manufactured.
IF TWO ZONES OVERLAP, THEY ARE THE SAME LEVEL
The merge tolerance is held to at least the combined zone half-widths. Otherwise two levels a fraction of an ATR apart refuse to merge and then draw overlapping boxes anyway, and the geometry contradicts itself on the chart for anyone to see. It is a small thing that quietly tells you the tool was never looked at.
A LEVEL IS AN ANCHOR, NOT A TRAILING AVERAGE
Levels merge as new candidates arrive, and the merged price is a COUNT-WEIGHTED mean: the tenth candidate moves the level by a tenth of the gap, not half of it. This sounds like a detail. It is not. A level that moves halfway toward every new candidate will slide toward price — because price is where new candidates come from — until it is no longer an anchor at all, but a trailing average sitting in the middle of the action, "tested" on every swing. The maths here is the difference between a level and a moving average with extra steps.
Levels are retired by DISTANCE, and confluence buys REACH. A level far from price is useless however many voices it has; a level at price is what you are trading. But eviction cannot simply drop the weakest, either — every level is BORN with one voice, so a weakest-first rule kills every new level in the cradle, before it can earn a second, and the chart slowly fills with ancient far-away fossils while nothing can form where price actually is. Confluence buys a level the right to be further away. It does not buy it immortality.
THE REVERSAL TRADE — because nobody looks at a level to admire it
Price tests the level and closes back out. Entry at the CLOSE, stop beyond the level, target a fixed R multiple.
ENTRY IS THE CLOSE, for the event and for the control alike. A rejection is a SIGNAL, not a fill.
Entering at the level — a better price — while the control enters at the close hands every level a
free head start, and it would "win" without the level having done anything at all.
THE R MULTIPLE IS FIXED so that the event and the control are measured on IDENTICAL geometry. A
variable target against a fixed-target control is not a comparison: the near target is reached more
often AND resolves inside the grading horizon more often, so the two are not even being asked the
same question.
THE NEXT OPPOSING LEVEL is drawn too, and separately tested: is it reached before the stop, and HOW
FAR AWAY IS IT IN R? A hit rate with no distance attached is a fact about the distance, not about
the levels — a target half a unit of risk away being reached often proves nothing.
Signals fire only at the levels actually on screen. Every level keeps its record; only the ones you are watching can fire. You do not trade a level twelve levels away from price.
And when a level BREAKS, you are told. A level holding is the reversal; a level giving way is the other half of why anyone draws one. Breaks are marked with an x and carry their own alerts — reported as pure information, with no trade framed and no claim made, because the break is not what this engine calibrated. Saying so is cheaper than pretending otherwise.
NON-REPAINT, AND ITS HONEST COST
Pivots confirm some bars late. The kernel extremum confirms a half-window late — a centred kernel looks into the future, and we refuse to. So a level appears some bars AFTER the swing that created it. That lag is the price of not repainting and it is paid deliberately.
Levels, tests, holds, breaks, signals and every calibration event are computed on CONFIRMED bars only. The HTF read uses lookahead_off. Nothing is drawn and then moved.
DATA AND SCOPE
Any symbol, any timeframe. ATR-normalised throughout. Volume improves the score but is NOT required — without it the volume-node voice simply abstains rather than guessing.
HOW TO USE
0. Turn the KEY on once (Dashboard & theme > Show the key). It explains the six glyphs. Turn it off
again — you only need it the first time.
1. MIN VOICES is the one input that matters. 1 gives you the forty-line wallpaper every other S/R
script gives you. 2 requires agreement. 3 shows only the prices several independent methods
arrived at on their own. Raise it until the chart shows levels you would actually trade.
2. Read the hold record. "Held 3/4" tells you more than any colour ever will.
3. READ THE CONFLUENCE VERDICT BEFORE YOU WEIGHT ANY OF IT. If the voices do not rank here, a level
is a LOCATION, not a probability — treat it as context, not as a signal.
4. Wait for the rejection: price into the level, close back out, on real volume.
5. Entry, stop and target are drawn. They are arithmetic, not advice.
ALERTS
Support held · Resistance held · Any rejection · Support broke · Resistance broke
EXPORTS (Data Window — consume from other scripts via input.source())
EXP_Sup1, EXP_Sup2, EXP_Res1, EXP_Res2, EXP_SupVoices, EXP_ResVoices, EXP_Signal, EXP_Entry, EXP_Stop, EXP_Target, EXP_ConfluenceEdge
CONCEPT CREDIT
Support/resistance and polarity are long-standing public trading concepts with no single author; the written tradition runs through Charles Dow, Richard Wyckoff and Edwards & Magee.
The TRADING-RANGE BREAK — the formal S/R rule — was first tested at scale by William Brock, Josef Lakonishok and Blake LeBaron, "Simple Technical Trading Rules and the Stochastic Properties of Stock Returns", Journal of Finance 47(5), 1992. Their findings were later shown to be vulnerable to data-snooping (Sullivan, Timmermann and White, 1999) — which is precisely why this tool MEASURES the rule on your instrument instead of asserting it.
Nonparametric kernel regression for level detection is from Andrew W. Lo, Harry Mamaysky and Jiang Wang, Journal of Finance 55(4), 2000; the Nadaraya-Watson estimator is due to Nadaraya and Watson (1964). ATR — J. Welles Wilder. Triple-barrier forward labelling — Marcos Lopez de Prado. Welch's t-test — B. L. Welch.
The confluence gate, the voice model, the episode-based hold record, the confluence-ranking test and the direction-matched control are the author's own. Clean-room implementation; no third-party Pine code is reused. Not affiliated with, nor endorsed by, any of the above.
HONESTY AND LIMITATIONS
Calibration is IN-SAMPLE, with no costs or slippage, and uses overlapping windows. A proven in-sample edge is NOT a guarantee out-of-sample. Real fills, spreads and commissions will reduce it.
The confluence gate is one rule among many — a different tolerance gives different levels.
Confluence is TESTED here, not assumed. If the panel says the extra voices do not rank, then on this instrument they do not, and no amount of agreement between methods will change that.
Both barriers on one bar: the STOP is assumed first — conservative, and the only assumption that cannot flatter the result. Unresolved trades at the horizon are marked to market, not booked as losses. Nothing is marked PROVEN below t = 1.96, and nothing is rated at all below the minimum sample.
Nothing in this script predicts price.
DISCLAIMER
Research and educational tool only. NOT financial advice, NOT a recommendation, and NO guarantee of results. Entry, stop and target output is arithmetic, not advice. Trading carries risk of loss. Test out-of-sample and make your own decisions. The author accepts no liability for any use.
Four lines. Two above price, two below. That is the whole chart.
Every other support/resistance tool has the opposite problem. It finds forty levels and leaves you to work out which two matter. Forty levels is not information, it is wallpaper — and a level you have to hunt for is a level you will not trade.
So this tool inverts the design. It does not ask "where are the levels?" It asks:
WHICH LEVEL WOULD I ACTUALLY TRADE, RIGHT NOW, AND WHY SHOULD I BELIEVE IT?
A price is only promoted to a level when SEVERAL INDEPENDENT METHODS AGREE ON IT. One method finding a level proves nothing — every method finds levels everywhere. The signal is AGREEMENT.
This is a research and framing tool. It is NOT a strategy, NOT a signal service, and NOT a validated edge.
THE SIX VOICES — four propose, two confirm
PROPOSERS. Each nominates candidate prices, independently:
◆ SWING PIVOT the classic. Where price actually turned.
~ KERNEL EXTREMUM the turning point of the SMOOTHED price (Nadaraya-Watson), which is the shape
rather than the noise. This is Lo, Mamaysky and Wang's method, and it finds
structurally different levels from a raw pivot. That independence is exactly
what makes agreement between the two worth something. Agreement between two
methods that make the same mistakes is worth nothing at all.
⇈ HIGHER TIMEFRAME a swing on the HTF. The level a bigger participant is watching.
▣ PRIOR PERIOD yesterday's high and low. Last week's high and low. The most watched prices on
any chart — and missing from almost every auto-S/R script on TradingView.
CONFIRMERS. They do not nominate, they vouch:
▪ VOLUME NODE the level sits where volume actually transacted. Real business was done here,
not merely a turning point.
○ ROUND NUMBER the psychological grid.
Candidates within an ATR tolerance merge, and the merged level inherits every voice that spoke for it. A level needs MIN VOICES to exist at all. Everything below that is DISCARDED, not hidden. Then only the nearest two above and two below are drawn.
The label tells you why the level is there: "◆~▣▪ 4v held 3/4 24,247.00" — four independent voices, tested four times, held three.
AND THEN THE PART NOBODY DOES: WE TEST WHETHER CONFLUENCE ACTUALLY RANKS
"Levels are stronger when several methods agree" is one of the most repeated claims in technical analysis and almost nobody has ever checked it. It is checkable. So the panel reports:
High confluence (3+) +0.24R n=61 PROVEN
Low confluence -0.03R n=88
Control (unconditional) +0.02R n=240
DOES CONFLUENCE RANK? YES — more voices IS better
And the control is DIRECTION-MATCHED. Reversals at support are overwhelmingly LONG on a drifting index — and a long-biased event set compared against a 50/50 control is handed the drift for free and calls it an edge. Longs are compared only with control longs, shorts only with control shorts, and the control is then blended back using the events' OWN direction mix. It is a subtle trap and it will manufacture an edge out of nothing if you let it.
And the verdict is a TEST, not a comparison. High confluence is measured against low confluence with a Welch t-test, and the difference must clear |t| > 1.96 before it is allowed to be a finding. Below that, the panel prints the least satisfying answer there is — NO DIFFERENCE — because that is the honest one. A tool that reports a 0.02R gap as a verdict is not measuring anything, it is decorating.
If the extra voices do not rank on your instrument, then on your instrument they do not rank, and no amount of agreement between methods will change that. That row is the reason this script exists.
THE HOLD RECORD — and why "held 3/4" is not what most scripts mean by it
A TEST IS AN EPISODE, NOT A BAR. Price arrives at the level and the test stays OPEN until price LEAVES it — back the way it came (HELD) or straight through (BROKE). A bar that closes INSIDE the zone has resolved nothing and is counted as nothing.
Counting every touching bar as a completed test drops an entire consolidation into the denominator as failures, and manufactures hold rates near 10% that say nothing about the level and everything about the counter. An unresolved test is neither a hold nor a break, exactly as an unresolved trade is neither a win nor a loss.
AND A TEST IS AN APPROACH, NOT A BAR TOUCHING A BOX. Price exits the zone (HELD), the next bar dips straight back in — and without a re-arm rule that counts as a brand-new test. Chop sitting on a level then logs a hundred "tests" that were really one event. Measured live before this was fixed: 224 tests of a single level on a 5m chart, and hold rates that all landed between 61% and 75% no matter which level you looked at. A statistic that cannot tell any two levels apart is not measuring the levels — it is measuring the bar size. Price must now travel clear of the zone before the level can be tested again. One approach, one test.
The volume filter gates the SIGNAL and never the RECORD. A level that holds on thin volume still HELD. Quietly dropping it from the numerator while leaving it in the denominator is how a hold rate gets manufactured.
IF TWO ZONES OVERLAP, THEY ARE THE SAME LEVEL
The merge tolerance is held to at least the combined zone half-widths. Otherwise two levels a fraction of an ATR apart refuse to merge and then draw overlapping boxes anyway, and the geometry contradicts itself on the chart for anyone to see. It is a small thing that quietly tells you the tool was never looked at.
A LEVEL IS AN ANCHOR, NOT A TRAILING AVERAGE
Levels merge as new candidates arrive, and the merged price is a COUNT-WEIGHTED mean: the tenth candidate moves the level by a tenth of the gap, not half of it. This sounds like a detail. It is not. A level that moves halfway toward every new candidate will slide toward price — because price is where new candidates come from — until it is no longer an anchor at all, but a trailing average sitting in the middle of the action, "tested" on every swing. The maths here is the difference between a level and a moving average with extra steps.
Levels are retired by DISTANCE, and confluence buys REACH. A level far from price is useless however many voices it has; a level at price is what you are trading. But eviction cannot simply drop the weakest, either — every level is BORN with one voice, so a weakest-first rule kills every new level in the cradle, before it can earn a second, and the chart slowly fills with ancient far-away fossils while nothing can form where price actually is. Confluence buys a level the right to be further away. It does not buy it immortality.
THE REVERSAL TRADE — because nobody looks at a level to admire it
Price tests the level and closes back out. Entry at the CLOSE, stop beyond the level, target a fixed R multiple.
ENTRY IS THE CLOSE, for the event and for the control alike. A rejection is a SIGNAL, not a fill.
Entering at the level — a better price — while the control enters at the close hands every level a
free head start, and it would "win" without the level having done anything at all.
THE R MULTIPLE IS FIXED so that the event and the control are measured on IDENTICAL geometry. A
variable target against a fixed-target control is not a comparison: the near target is reached more
often AND resolves inside the grading horizon more often, so the two are not even being asked the
same question.
THE NEXT OPPOSING LEVEL is drawn too, and separately tested: is it reached before the stop, and HOW
FAR AWAY IS IT IN R? A hit rate with no distance attached is a fact about the distance, not about
the levels — a target half a unit of risk away being reached often proves nothing.
Signals fire only at the levels actually on screen. Every level keeps its record; only the ones you are watching can fire. You do not trade a level twelve levels away from price.
And when a level BREAKS, you are told. A level holding is the reversal; a level giving way is the other half of why anyone draws one. Breaks are marked with an x and carry their own alerts — reported as pure information, with no trade framed and no claim made, because the break is not what this engine calibrated. Saying so is cheaper than pretending otherwise.
NON-REPAINT, AND ITS HONEST COST
Pivots confirm some bars late. The kernel extremum confirms a half-window late — a centred kernel looks into the future, and we refuse to. So a level appears some bars AFTER the swing that created it. That lag is the price of not repainting and it is paid deliberately.
Levels, tests, holds, breaks, signals and every calibration event are computed on CONFIRMED bars only. The HTF read uses lookahead_off. Nothing is drawn and then moved.
DATA AND SCOPE
Any symbol, any timeframe. ATR-normalised throughout. Volume improves the score but is NOT required — without it the volume-node voice simply abstains rather than guessing.
HOW TO USE
0. Turn the KEY on once (Dashboard & theme > Show the key). It explains the six glyphs. Turn it off
again — you only need it the first time.
1. MIN VOICES is the one input that matters. 1 gives you the forty-line wallpaper every other S/R
script gives you. 2 requires agreement. 3 shows only the prices several independent methods
arrived at on their own. Raise it until the chart shows levels you would actually trade.
2. Read the hold record. "Held 3/4" tells you more than any colour ever will.
3. READ THE CONFLUENCE VERDICT BEFORE YOU WEIGHT ANY OF IT. If the voices do not rank here, a level
is a LOCATION, not a probability — treat it as context, not as a signal.
4. Wait for the rejection: price into the level, close back out, on real volume.
5. Entry, stop and target are drawn. They are arithmetic, not advice.
ALERTS
Support held · Resistance held · Any rejection · Support broke · Resistance broke
EXPORTS (Data Window — consume from other scripts via input.source())
EXP_Sup1, EXP_Sup2, EXP_Res1, EXP_Res2, EXP_SupVoices, EXP_ResVoices, EXP_Signal, EXP_Entry, EXP_Stop, EXP_Target, EXP_ConfluenceEdge
CONCEPT CREDIT
Support/resistance and polarity are long-standing public trading concepts with no single author; the written tradition runs through Charles Dow, Richard Wyckoff and Edwards & Magee.
The TRADING-RANGE BREAK — the formal S/R rule — was first tested at scale by William Brock, Josef Lakonishok and Blake LeBaron, "Simple Technical Trading Rules and the Stochastic Properties of Stock Returns", Journal of Finance 47(5), 1992. Their findings were later shown to be vulnerable to data-snooping (Sullivan, Timmermann and White, 1999) — which is precisely why this tool MEASURES the rule on your instrument instead of asserting it.
Nonparametric kernel regression for level detection is from Andrew W. Lo, Harry Mamaysky and Jiang Wang, Journal of Finance 55(4), 2000; the Nadaraya-Watson estimator is due to Nadaraya and Watson (1964). ATR — J. Welles Wilder. Triple-barrier forward labelling — Marcos Lopez de Prado. Welch's t-test — B. L. Welch.
The confluence gate, the voice model, the episode-based hold record, the confluence-ranking test and the direction-matched control are the author's own. Clean-room implementation; no third-party Pine code is reused. Not affiliated with, nor endorsed by, any of the above.
HONESTY AND LIMITATIONS
Calibration is IN-SAMPLE, with no costs or slippage, and uses overlapping windows. A proven in-sample edge is NOT a guarantee out-of-sample. Real fills, spreads and commissions will reduce it.
The confluence gate is one rule among many — a different tolerance gives different levels.
Confluence is TESTED here, not assumed. If the panel says the extra voices do not rank, then on this instrument they do not, and no amount of agreement between methods will change that.
Both barriers on one bar: the STOP is assumed first — conservative, and the only assumption that cannot flatter the result. Unresolved trades at the horizon are marked to market, not booked as losses. Nothing is marked PROVEN below t = 1.96, and nothing is rated at all below the minimum sample.
Nothing in this script predicts price.
DISCLAIMER
Research and educational tool only. NOT financial advice, NOT a recommendation, and NO guarantee of results. Entry, stop and target output is arithmetic, not advice. Trading carries risk of loss. Test out-of-sample and make your own decisions. The author accepts no liability for any use.
リリースノート
v1.1 — Correctness update (affects drawn levels)The volume-profile high/low were being recomputed only on every 10th bar, so the high-volume-node "voice" was measured over a fraction of its lookback and could sit at the wrong price. They now recalculate on every bar. As a result, on instruments that report volume, confluence levels that rely on volume-node agreement are more accurate than in v1.0 — some levels may shift to their corrected prices. Also moved the RVOL average and the swing-pivot detection to evaluate on every bar, per Pine's requirement for series functions. No inputs, alerts, or EXP_ outputs changed; the confluence-ranking test, the hold record, and the reversal logic are untouched.
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。