Opening Price Deviation Tracker v2 - Buffer Zones - VWAP [ViZ]OPENING PRICE DEVIATION TRACKER v2 — BUFFER ZONES — VWAP
WHAT IT DOES
Measures how far price has travelled from the opening price of a chosen anchor
period, and maps that distance onto a fixed percentage grid on the chart.
The reasoning is that the open of the current period is a reference every
participant on the instrument shares, and that distance from it expressed in
percent is comparable across instruments and across time in a way raw price
distance is not. A 1% move from the weekly open means the same thing on a
30,000-point index as on a 40-dollar stock.
Around that single idea the script adds a tolerance band on each level, a
permanent record of which levels each period actually reached, a three-timeframe
summary panel, optional trend and volume references, and three alert channels
that differ in what they detect rather than only in speed.
Every component keys back to the same anchor open. This is not a set of unrelated
tools sharing a pane.
1. THE ANCHOR OPEN, AND WHY IT IS LATCHED
The Timeframe input sets the anchor period — weekly by default, but any timeframe
longer than the chart's.
The script obtains that period's opening price by latching it: on the first chart
bar of a new anchor period, that bar's own open IS the period's open, so the value
is stored and held until the next rollover.
There is no request.security() call anywhere in the script. Not for the anchor
open, not for the three table columns, not for VWAP.
That matters for a specific reason worth stating plainly. The obvious way to build
this is request.security with lookahead enabled, and for an OPEN that is actually
defensible — an open is fixed by the first tick of its period, so requesting it
with lookahead never returns a number that was unknowable at the time. Without the
flag the same call returns the PREVIOUS period's open until the current one closes,
which puts the whole grid one full anchor period behind itself, so simply turning
the flag off is not an option. Latching sidesteps the argument entirely: the value
is a chart bar's own open, so it provably cannot look ahead, there is no
higher-timeframe request to disclose, and there is no real-time-to-historical
transition to reason about. Levels drawn on historical bars are the levels that
genuinely existed at the time, and they do not change on reload.
The period high and low used by the panel are accumulated from chart bars for a
different and stronger reason: a period's extremes are only settled when the period
ENDS, so requesting those with lookahead genuinely would leak future data onto
historical bars. Open safe, extremes not — that distinction is the whole substance
of the question.
Latching does cost something, in the form of four documented behaviours. They are
in the LIMITATIONS section, and reading it will explain most of what could
otherwise look like a bug.
2. THE DEVIATION GRID
From the latched open the script builds five levels above and five below, spaced by
a fixed percentage step, with the 0% line marking the open itself. Line width
increases with distance, so ±1 is a hairline and ±5 is the heaviest — depth is
readable without checking the labels. Each level carries a right-edge label showing
both its price and its percentage offset. Colours darken progressively outward from
the two base colours you set.
The step comes from a preset list, each labelled with its own value:
0.25% — scalping / very low volatility
0.3875% — reactive / lower timeframes
0.50% — intraday
1.00% — balanced (default)
2.00% — swing / higher timeframes
3.00% — high volatility / highest timeframes
Custom — any value from 0.1 upward
Because the grid always runs to five levels, the step also fixes its total span: 1%
covers ±5%, 2% covers ±10%, 0.25% covers ±1.25%. Pick the step whose span roughly
brackets what your anchor period typically moves. Too small and price sits
permanently off the top or bottom of the grid; too large and it never leaves the
first band, and nothing the script draws will tell you anything.
As orientation rather than instruction: the lower steps suit major FX pairs and
large-cap equities on intraday anchors, the middle of the range suits indices and
most equities on daily and weekly anchors, and the upper steps suit small caps,
commodities and crypto, or any weekly-and-above anchor. Volatility varies more
inside an asset class than between them, so verify against the instrument in front
of you and switch to Custom once you know what you want.
The step also drives the panel's Zone and To Next rows, the buffer positions, touch
detection and the markers — one number, one grid, everywhere.
3. LINE DISPLAY
Three modes:
Off — no grid lines; panel, markers and alerts still work
Show All — full grid across history and the live period
Touched Only (Historical) — live period shows the full grid; completed periods
keep only the levels price actually reached
The third is the default and is the one worth understanding. On a chart with months
of history, showing all eleven lines per period is unreadable. Retaining only the
levels each period actually reached leaves a permanent record of how far each period
extended — which is usually the only thing you wanted from the older periods.
Those historical segments are stored as drawn objects and accumulate without an
explicit cap, bounded only by TradingView's 500-line budget. When the ceiling is
reached the platform deletes the oldest, so the recent history you actually look at
is never what disappears. The 0% opening line is exempt from filtering and always
renders in full.
4. BUFFER ZONES
Each deviation level, and the open itself, can carry a translucent band drawn a set
percentage of price above and below it — eleven bands in total.
Two reasons for them. Price rarely reacts at an exact tick; it reacts in a region
around a reference, so a band represents the level more honestly than a line. And
the band gives an anticipatory alert trigger: entry into the band fires before the
level is reached.
The live period's bands are drawn spanning the current period. Bands from previous
periods are also retained, but only for levels that were actually touched, so past
structure appears where something happened rather than as uniform wallpaper.
Historical retention is capped at 44 periods, which is the limit of the platform's
500-drawing budget once the live period's own eleven boxes are accounted for; lower
it freely for a cleaner chart, nothing else depends on it.
One interaction to be aware of: buffer size is a percentage of price and does not
scale with the grid step. Lead time depends on the RATIO of the two, not the
absolute size. At roughly a quarter of the deviation step the warning is genuinely
early; at half or more the warning and the touch collapse into the same bar. The
default 0.15 against a 1% grid is 15%. Against the 0.3875% preset the same value is
39%, which effectively eliminates the early warning; against the 3% preset it is 5%,
which may be too tight to see. If you change the step, check the buffer against it.
5. TOUCH MARKERS
Optional, and off by default. A small marker is placed on the first bar of each
period that reaches each level — one marker per level per period, re-armed at every
rollover.
Marker shapes:
● circle — touch: the bar's range reached the level.
▲ ▼ triangle — acceptance: the bar CLOSED beyond the level. Points up above the
open, down below it.
◆ diamond — rejection: the bar tagged the level and closed back, with a retreat wick
larger than the threshold you set.
✕ cross — gap through: the bar reached the level without trading into it.
Three detail modes let you take just the touches, touches plus acceptance, or the
full touch / rejection / acceptance set. Rejection sensitivity is adjustable as a
fraction of the bar's range, 0.5 by default; raise it toward 0.65 for a stricter
read. Marker range is adjustable up to ±5 levels, ±4 by default. The 0% line can be
marked too, optionally. Colours inherit from the grid by default, so a +3 marker
matches the +3 line; the 0% marker is always blue to match the opening-price line.
Each marker's tooltip states the level and the classification.
Markers use the same reach test as the historical line segments — directional above
and below the open, straddle at 0% — so a marker and a retained line segment can
never disagree about whether a level was touched. Markers appear at bar close by
default; an option tags them on the live bar instead, in which case the shape may
still change before the bar closes, because acceptance and rejection both depend on
where the bar ends up. That option is visual only and affects no alert.
6. BAR COLOURING
Optional, with two selectable sources.
Deviation Levels colours each bar by which of the eleven grid zones it closed in,
using the same progressively darkening shades as the lines, with the "between
levels" colour for bars inside the first band. The candles then carry the deviation
reading themselves, which means you can switch the grid off entirely and still see
depth — a genuinely clean chart that still reports.
VWAP / Bands colours by position relative to the anchored VWAP and its bands
instead: five zones, beyond the outer band, beyond the inner band, and between, on
each side. It falls back to plain above/below VWAP when bands are off. Useful when
you want the grid for structure but volume-weighted price for bias. This mode needs
only volume and a valid anchor, so it works with the VWAP line itself hidden.
Bars before the first anchor rollover are deliberately left uncoloured rather than
being painted a default shade, since no zone reading exists for them yet.
7. MOVING AVERAGE
Optional SMA or EMA, adjustable period, 200 by default. Context rather than signal:
it exists so you can see whether a level is being approached with or against the
prevailing trend, which usually matters more than the touch itself.
8. VWAP
Optional anchored VWAP with its own reset selection, independent of the deviation
anchor: daily session, weekly, monthly, quarterly, semi-annual, annual, Match
Deviation Anchor, or a custom timeframe. Daily session matches the standard
TradingView VWAP. The multi-month options are derived from the monthly rollover and
then gated by calendar month, so they land on real calendar boundaries — January /
April / July / October, January / July, and January — rather than drifting from an
arbitrary reference point.
Match Deviation Anchor is the setting for a single consistent frame of reference:
grid and VWAP then reset on the same bar and describe the same period. The
independent options cover the common case of a session VWAP underneath a weekly or
monthly grid.
Two optional band pairs, in either standard-deviation or percentage units, are
independent of the deviation grid preset. The outer pair is rendered a step more
transparent than the inner, so depth reads without a second colour input, and a very
light fill between the inner pair is available but off by default so it does not
compete with the buffer zones. Note that in sigma mode the bands pinch shut at each
anchor reset and flare open over following bars — that is inherent to anchored
standard deviation, not a fault; percentage mode does not do it.
The line and bands are blanked on the anchor bar itself, so the plot BREAKS at each
reset instead of drawing a diagonal from the old period's last value to the new
one's first.
VWAP needs volume, and needs an anchor longer than the chart timeframe. If either
is missing, an on-chart label states which — including when VWAP is hidden but the
VWAP bar-colouring mode is active and starved.
9. THE DATA PANEL
Projects the same deviation grid onto three user-selectable timeframes, each
measured from that timeframe's own latched opening price. Defaults are daily,
weekly and monthly, and the column matching the indicator's own anchor is marked
with a diamond. The title bar shows the active step, for example "1% grid".
Rows, in Full detail:
Open — that period's opening price, at the symbol's own precision.
Δ from Open — percentage move from that open, with a direction arrow. Colour
intensity scales with magnitude, and the saturation ceiling scales as the square
root of the column's length, so at the 1% preset the daily column saturates around
2%, the weekly around 4.5% and the monthly around 9.2%. Each column is therefore
meaningful on its own scale, rather than one fixed ceiling that the longest column
always maxes out.
Zone — which band price currently occupies, shown as "+1 → +2", "0 → -1" and so on,
filled with the SAME colour as the corresponding chart grid line. Beyond the grid it
reads "> +5" or "< -5" rather than silently clamping.
To Next % — distance to the level above and the level below. This is the practical
number for judging whether a target is in reach.
Range Pos — where price sits inside that period's realised high-low range so far, as
a percentage with a small meter. 90% means price is near the top of everything the
period has covered.
State — bullish, bearish or neutral, combining direction from Δ with conviction from
Range Pos, so it is not merely a restatement of the sign of Δ. When the range is
unknown it degrades to direction only.
Compact detail drops To Next and Range Pos and closes the gap rather than leaving
empty rows. The panel's whole surface palette — header band, row banding,
separators, anchor-column wash — is derived from one background colour input, and
text automatically switches to a dark set on light backgrounds. Colour is carried by
text tint throughout, with the Zone row as the single filled block and the panel's
focal point.
Three column states exist. A column SHORTER than the chart timeframe reads "below
chart TF", because a shorter-timeframe open cannot be resolved honestly from a
longer chart bar. A column whose boundary has not appeared inside the loaded chart
history reads "no boundary yet" — see LIMITATIONS. Otherwise it reports normally.
The point of three columns at once is alignment. Bullish daily, bearish weekly,
bullish monthly is a different situation from all three agreeing, and the panel makes
that visible without changing timeframe.
10. ALERTS — THREE CHANNELS
The three channels differ in WHAT THEY DETECT, not only in how fast they report.
Each has its own toggle.
BUFFER (early warning) — fires when price first enters the band around a level.
Dispatches intrabar, the moment the band is entered; delivered at the bar close it
would already have been overtaken by events. On by default.
AT LEVEL — fires on any bar whose range CONTAINS a level, and keeps repeating for
as long as price stays there. Dispatches intrabar, on the first qualifying tick.
This is safe intrabar because the test reads only high and low: inside a live bar
the range only ever widens, so once it engulfs a level no later tick can un-happen
it. The cost is partial reporting — a candle running through +1, +2 and +3 names +1,
because that is what was true at the tick it fired. On by default.
FIRST TOUCH — fires the first time each level is reached in the anchor period, then
stays silent about that level until the next period. Dispatches at bar close,
because its wording carries a classification — touch, closed beyond, rejected — and
all of those read where the bar closed, which on a live bar is only the current
price and could flip tick to tick. Evaluated once on a finished bar, it loops every
level and reports all of them. Off by default. Works with the markers hidden.
The two level channels also DETECT differently, which is why both exist. At Level
requires the bar to straddle the level. First Touch tests directionally, so a bar
that jumps clean over a level without trading back into it is reported by First
Touch and is structurally invisible to At Level. That is the gap-through case, and
it is exactly what a news candle does.
So: buffer and at-level answer "tell me now". First touch answers "tell me
everything, a moment later".
All three messages render as ": | Price: ", with the
buffer channel adding " | Level: ", so anything parsing them downstream sees
one consistent shape. No timestamps are embedded, because every delivery method
TradingView offers already stamps the notification.
TO SET UP: create ONE alert on the indicator with the condition set to "Any alert()
function call". The three toggles decide what it reports. The long string
TradingView pre-fills is the alert's NAME, auto-built from every input — rename it
in the dialog; it is not the message.
If you want a different sound or webhook per channel, add the indicator to the chart
more than once, enable exactly one channel per instance, strip the extra instances
of all drawing, and name each chart alert after its channel. Keep the anchor and
preset identical across instances or the channels start describing different grids.
One known behaviour: if a single bar enters more than one buffer band, the buffer
message names the last one evaluated rather than listing all of them. The alert
still fires; the label is simply not exhaustive. Most visible on fast bars, or when
buffer size approaches half the deviation step and bands begin to overlap.
11. CHOOSING A CHART TIMEFRAME AND ANCHOR
The useful rule of thumb is that the anchor period should span roughly 20 to 100
bars of the chart timeframe. Fewer and the grid has no room to develop; many more
and the levels are too distant to be actionable within a session.
In practice: 1m to 15m charts pair with daily and weekly anchors, hourly and 4-hour
with weekly and monthly, daily and above with monthly, quarterly and annual. For
the panel, suggested column sets are 4H/D/W under a weekly anchor, D/W/M under a
weekly or monthly anchor, and M/3M/12M under a quarterly anchor.
Some ways it gets used:
Mean-reversion context — a level reached early in a period, price stalling inside
the band, moving average leaning the other way, is a different proposition from the
same level reached mid-expansion. The rejection marker is what separates the two
after the fact.
Continuation context — sequential first-touches inside one period, left on the
chart by the touched-only display, show whether a period is expanding steadily or
stalling at the same band repeatedly. Acceptance triangles at successive levels read
differently from a diamond at the same level three times.
Risk framing — because levels are percentage distances, To Next % converts directly
into stop and target distances in the same units you size positions in.
Period bias — the panel alone, grid switched off, works as a compact
three-timeframe bias readout.
Monitoring — the first-touch channel lets you watch a list of instruments for
meaningful extension from their period open without staring at charts, and the
buffer channel gives the heads-up before it happens.
None of the above is prescriptive. The defaults are a reasonable place to start
rather than a recommendation, and the script is deliberately built so that almost
every part of it can be moved without breaking anything else — so move things.
Put the same anchor on three different chart timeframes and watch how the grid
changes character. Run the panel's three columns as 4H/D/W for a session, then as
D/W/M, and see which alignment you actually read. Switch the VWAP anchor from
session to weekly, or match it to the deviation anchor, and notice how differently
the two reference points behave when they reset together versus separately. Try
the bar colouring on one source, then the other, with the grid lines switched off
entirely. Step the deviation preset up and down on an instrument you know well
until the spacing stops feeling arbitrary — that is usually the moment the tool
starts being useful, and it is different for every instrument and every holding
period. Custom exists for when you get there.
Nothing you change is destructive and nothing is hidden behind a setup process:
every input has a tooltip explaining what it does and, where it matters, what it
interacts with. The fastest way to understand any of this is an afternoon of
switching things on and off on a chart you already have an opinion about.
12. LIMITATIONS AND KNOWN BEHAVIOURS
These are consequences of the design choice in section 1, and are stated rather
than hidden.
Leading partial period is blank. Nothing is latched until the first rollover INSIDE
loaded history, so the leftmost partial anchor period has no open and therefore no
grid, no buffers, no labels and no bar colour. It scales inversely with chart
resolution — trivial on a 15-minute chart holding thirty weeks, pronounced on a
1-minute chart holding two. Scroll hard left to see it. It is not a fault, and it is
the exact price of using no lookahead.
Columns longer than loaded history report nothing. No boundary in history means no
open, which cascades through every row, so the Δ cell says "no boundary yet" to make
the cause legible instead of leaving the column looking broken. This is a bar-density
effect: roughly 20,000 loaded one-minute bars is about 2.5 months of a 6.5-hour
equity session but under three weeks of a 24-hour instrument, so a monthly column
resolves on the former and not the latter. It also moves with the viewer's data
plan, so two users on the same chart can see different columns populated. The remedy
in every case is to view the same period on a higher chart timeframe — and in
practice column choice tracks chart timeframe anyway.
The open is session-dependent. It is the first chart bar's open under your CURRENT
session settings, which on an extended-hours symbol need not equal the feed's
official daily open. Verified to line up with session boundaries across equities,
indices and FX; it is simply the property to know about when comparing against a
platform VWAP or a broker's stated open.
The first snapshot is skipped. On the very first rollover in loaded history there is
no preceding period to snapshot, so that one period's historical segments and buffer
boxes are absent. It degrades quietly.
Buffer does not scale with the grid, as described in section 4.
The grid is not volatility-adaptive. Levels are fixed arithmetic percentages of the
open. The script does not measure realised volatility and will not widen the grid in
a volatile regime — step selection is yours to make and to revisit.
References need data. The moving average needs its full lookback before plotting;
VWAP needs volume and an anchor longer than the chart timeframe.
Drawing budgets. Retained line segments and markers share TradingView's per-script
object limits. When a ceiling is reached the oldest objects are dropped, so recent
history is never what goes missing. Reducing the marker range or the historical
buffer lookback extends how far back the rest survives.
Chart type. Use standard candles or bars. Heikin Ashi, Renko, Kagi and range bars
synthesise their own prices, which distorts every level, every touch and every alert
this script produces.
Finally, this is a measurement and context tool. It reports where price is relative
to a period open and tells you when that changes. It does not forecast direction,
and nothing in it should be read as a prediction or as a standalone entry system.
13. NOTES
Open source under the Mozilla Public License 2.0, and the source is heavily
commented — every design decision above, including the ones I chose not to make and
why, is documented in the code itself alongside the reversion instructions.
All logic is self-contained. No external libraries, no imported code from other
authors, no request.security() of any kind.
Defaults ship usable rather than optimal for any one instrument: weekly anchor, 1%
grid, touched-only historical lines, 0.15% buffer with 44 periods of history,
200-period SMA, session VWAP with bands off, deviation bar colouring, markers off,
and the buffer and at-level alert channels enabled.
This is a separate publication from my earlier opening-deviation script rather than
an update to it, because the feature set and default behaviour differ enough that
replacing the original in place would change existing users' charts without warning.
The earlier version remains available and unchanged.
อินดิเคเตอร์

DMI Spread Dashboard ,5m 30m 1hDMI Spread Dashboard is a multi-timeframe directional-momentum monitor built around the Directional Movement Index (DMI) and Average Directional Index (ADX). It calculates the complete DMI structure independently on the 5-minute, 30-minute, and 1-hour timeframes, then organizes the results into one compact chart dashboard.
The indicator is designed to answer four separate questions:
1. Which side currently has directional control?
2. How large is the difference between positive and negative directional movement?
3. Is that directional difference expanding or contracting?
4. Is the underlying directional movement strong enough to be meaningful according to ADX?
Instead of displaying only a DMI crossover or a single ADX value, the dashboard separates direction, directional separation, trend strength, and momentum development. This helps users distinguish an established directional move from a weak crossover or a move that is losing participation.
HOW THE CALCULATIONS WORK
The script uses the traditional Directional Movement framework associated with J. Welles Wilder Jr.
For every selected timeframe, the script first compares the current high and low with those of the previous bar:
• Positive directional movement measures qualifying upward movement in the high.
• Negative directional movement measures qualifying downward movement in the low.
• When both sides move, only the qualifying dominant directional movement is retained according to the standard DMI comparison.
Positive and negative directional movement are smoothed using Wilder’s moving average method. Each smoothed value is then normalized by a Wilder-smoothed True Range and multiplied by 100 to produce +DI and -DI.
The script calculates ADX from the smoothed absolute difference between +DI and -DI relative to their combined value. ADX measures the strength of directional movement, not its direction. A high ADX can therefore occur during either bullish or bearish conditions.
The indicator then calculates its central measurement:
DMI Spread = +DI - -DI
A positive spread means +DI is greater than -DI and upward directional movement is dominant. A negative spread means -DI is greater than +DI and downward directional movement is dominant. A spread near zero indicates that neither side has established meaningful separation.
WHAT MAKES THE DASHBOARD DIFFERENT
The script does more than place standard DMI values from several timeframes into a table. It converts the relationship between +DI and -DI into a signed spread and then measures the bar-to-bar change in that spread.
This creates two separate forms of information:
• Direction identifies which side is currently dominant.
• Spread development identifies whether that dominance is expanding or contracting.
For a positive spread, an increase in the spread is classified as EXPANDING because bullish directional separation is increasing. A decrease is classified as CONTRACTING because bullish separation is weakening.
For a negative spread, a further decrease below zero is classified as EXPANDING because bearish directional separation is increasing. Movement back toward zero is classified as CONTRACTING because bearish separation is weakening.
This distinction is important because a market can remain technically bullish while its bullish DMI spread contracts. It can also remain technically bearish while bearish separation begins to weaken. The dashboard makes those changes visible without requiring users to compare multiple DMI plots manually.
The 5-minute, 30-minute, and 1-hour calculations are performed independently using each timeframe’s own price data. The 5-minute row can be used for short-term execution context, the 30-minute row for intermediate intraday structure, and the 1-hour row for broader directional context.
DASHBOARD COLUMNS
TIME
Identifies the independently calculated 5-minute, 30-minute, or 1-hour dataset.
+DI
Shows the magnitude of positive directional movement after Wilder smoothing and True Range normalization.
-DI
Shows the magnitude of negative directional movement after Wilder smoothing and True Range normalization.
SPREAD
Shows +DI minus -DI. Positive values indicate bullish directional dominance, while negative values indicate bearish directional dominance. The magnitude describes the separation between the two DMI components.
DIRECTION
Displays BULLISH when the spread is above zero, BEARISH when it is below zero, and NEUTRAL when the two values are equal.
ADX
Displays the Average Directional Index for the corresponding timeframe. ADX measures directional strength and does not determine whether the direction is bullish or bearish.
STRENGTH
Classifies ADX as STRONG or WEAK using the user-defined ADX Strength Threshold. The default threshold is 25. This threshold is a filter and should be adjusted when appropriate for the instrument and trading method.
STATUS
Displays one of four conditions:
• BULL CROSS: +DI has crossed above -DI.
• BEAR CROSS: +DI has crossed below -DI.
• EXPANDING: the prevailing directional spread is moving farther away from zero.
• CONTRACTING: the prevailing directional spread is moving toward zero or is no longer expanding.
When a new DMI cross is detected, the cross message temporarily takes priority over the expanding or contracting classification.
INTERPRETING MULTI-TIMEFRAME ALIGNMENT
Broad bullish alignment is present when all three spreads are positive. The alignment has stronger directional confirmation when the spreads are also expanding and ADX is above the selected threshold.
Broad bearish alignment is present when all three spreads are negative. The alignment has stronger directional confirmation when the negative spreads are expanding and ADX is above the selected threshold.
Mixed readings indicate timeframe disagreement. For example, a bullish 5-minute reading against bearish 30-minute and 1-hour readings may represent a short-term rebound within a broader bearish structure. It does not automatically confirm a larger bullish reversal.
A contracting spread should not automatically be interpreted as a reversal. It only indicates that the existing separation between +DI and -DI is narrowing. A crossover or additional price confirmation is required before directional control has formally changed under this model.
SUGGESTED WORKFLOW
1. Begin with the 1-hour row to identify the broader directional condition.
2. Use the 30-minute row to determine whether intermediate momentum agrees with or opposes the 1-hour condition.
3. Use the 5-minute row to monitor shorter-term changes, contractions, expansions, and DMI crosses.
4. Give greater weight to a setup when direction, spread development, and ADX strength agree across multiple timeframes.
5. Confirm dashboard readings with price structure, support and resistance, liquidity, volume, or another independent execution method.
The dashboard can be moved to the top-right, top-left, bottom-right, or bottom-left corner through the Dashboard Position input.
INPUTS
DI Length controls the smoothing period used to calculate +DI and -DI. The default is 14.
ADX Smoothing controls the smoothing period used for ADX. The default is 14.
ADX Strength Threshold determines when the dashboard labels ADX as STRONG. The default is 25.
Dashboard Position controls where the table appears on the chart.
ALERTS
The script provides separate bullish and bearish DMI cross alert conditions for the 5-minute, 30-minute, and 1-hour timeframes.
For confirmation-based use, alerts should normally be configured as “Once Per Bar Close.” Alerts notify users that a DMI relationship has changed; they are not automatic trade signals.
LIMITATIONS
This indicator does not predict future price direction and does not generate entries, exits, profit targets, or stop-loss levels.
DMI and ADX are derived from historical price movement and are lagging measurements. Crosses can occur after a move has already begun, and repeated crosses may occur during sideways or low-volatility markets.
ADX measures directional strength, not direction. A STRONG reading can accompany either bullish or bearish movement.
EXPANDING and CONTRACTING describe changes in the DMI spread. They do not guarantee price continuation or reversal.
Values from an open timeframe can change while that timeframe’s bar is still developing. A 30-minute or 1-hour reading is not final until its corresponding bar closes. Using “Once Per Bar Close” helps avoid acting on an unfinished alert condition, but users should still understand which timeframe is being evaluated.
When the indicator is used on a chart timeframe above five minutes, TradingView’s standard lower-timeframe request behavior may not reproduce every intermediate 5-minute event. For the most dependable observation of 5-minute changes and alerts, use the indicator on a 5-minute or lower chart.
The script should be used as a directional-context and confirmation tool rather than as a standalone trading system.
ORIGINALITY AND PURPOSE
DMI and ADX are established technical-analysis calculations. This script does not claim ownership of those underlying formulas.
The script’s contribution is its purpose-built interpretation and presentation layer: independently calculated 5-minute, 30-minute, and 1-hour DMI structures; a signed DMI spread; spread-expansion and contraction classification; timeframe-specific ADX strength; cross-state prioritization; configurable dashboard placement; and separate alert conditions.
These components are organized to help users evaluate directional control, separation, strength, and multi-timeframe agreement from one chart interface instead of manually comparing three separate DMI indicators.
Open-source users can inspect the calculations, adjust the parameters, and study how the multi-timeframe dashboard converts standard DMI components into a structured directional framework.
อินดิเคเตอร์

ICT BSL / SSL LiquidityICT BSL / SSL Liquidity is a market-structure based liquidity detection indicator designed to identify Buy Side Liquidity (BSL), Sell Side Liquidity (SSL), and potential liquidity sweeps directly on the chart.
The indicator detects confirmed swing highs and swing lows and converts them into visual liquidity zones. It then monitors these zones for specific sweep conditions, helping traders visually identify situations where price takes liquidity and closes back through the corresponding zone.
BSL zones are created from confirmed swing highs, while SSL zones are created from confirmed swing lows. When a valid sweep occurs, the zone is highlighted and a corresponding bullish or bearish sweep signal is displayed on the chart.
The indicator is designed primarily as a liquidity-analysis tool and can be used alongside price action, market structure, support/resistance, order flow, or other ICT/SMC concepts.
SIGNALS LOGIC:
1. SELL SIDE LIQUIDITY (SSL) — BULLISH SWEEP
SSL is created from a confirmed swing low.
The indicator tracks the liquidity level and its associated zone.
A bullish SSL sweep is detected when:
Price trades below the SSL level.
The lookback-period low moves below the liquidity level.
The candle closes above the zone body.
The sweep candle closes bullish.
• Once triggered, the SSL zone is frozen and highlighted.
• A bullish "B" signal is plotted below the candle.
2. BUY SIDE LIQUIDITY (BSL) — BEARISH SWEEP
BSL is created from a confirmed swing high.
The indicator tracks the liquidity level and its associated zone.
A bearish BSL sweep is detected when:
Price trades above the BSL level.
The lookback-period high moves above the liquidity level.
The candle closes below the zone body.
The sweep candle closes bearish.
• Once triggered, the BSL zone is frozen and highlighted.
• A bearish "S" signal is plotted above the candle.
3. LIQUIDITY ZONE INVALIDATION
A liquidity zone can be removed from active tracking when price breaks the level in the opposite direction according to the script's invalidation logic.
4. CONFIRMED SWING DETECTION
Liquidity levels are generated using confirmed swing highs and swing lows based on the selected Swing Length. Increasing the Swing Length generally produces fewer but more significant liquidity levels.
USER INPUTS:
Indicator Settings
• Swing Length
Determines the number of bars used on each side of a pivot to identify swing highs and swing lows. Higher values generally produce fewer and more significant liquidity levels.
• Candles Lookback
Defines the lookback window used when checking whether price has wicked through a liquidity level and reclaimed it.
• Maximum Active BSL Zones
Controls the maximum number of Buy Side Liquidity zones that remain actively tracked.
• Maximum Active SSL Zones
Controls the maximum number of Sell Side Liquidity zones that remain actively tracked.
Visual Settings
• Zone Gradient Bands
Controls the number of gradient bands used to render each liquidity zone. More bands create a smoother visual effect.
• Glow On Swept Level
Adds a visual glow around a liquidity level when it is swept.
• Color The Sweep Candle
Highlights the candle responsible for the detected liquidity sweep.
Color Settings
• Palette Theme
Choose between:
* Neon
* Muted
* Native
* Custom
• BSL Color
Custom color for Buy Side Liquidity when the Custom palette is selected.
• SSL Color
Custom color for Sell Side Liquidity when the Custom palette is selected.
WHY IT IS UNIQUE:
• Separates Buy Side Liquidity and Sell Side Liquidity into dedicated active zones.
• Uses confirmed swing points rather than simply marking every recent high or low.
• Combines liquidity levels with zone-based visualization instead of displaying only horizontal lines.
• Automatically extends active liquidity zones until they are swept or invalidated.
• Clearly distinguishes bullish SSL sweeps from bearish BSL sweeps.
• Uses gradient zone rendering to make liquidity areas easier to identify visually.
• Provides an optional glow effect when liquidity is swept.
• Only the sweep candle is highlighted, keeping the rest of the chart visually clean.
• Includes configurable limits for active BSL and SSL zones to help manage chart clutter and drawing-object usage.
• Built-in alert conditions are available for both bullish SSL sweeps and bearish BSL sweeps.
HOW USER CAN BENEFIT FROM IT:
This indicator can help traders:
• Identify areas where liquidity may be resting above swing highs or below swing lows.
• Spot potential liquidity sweeps and rejection behavior more easily.
• Visually track active liquidity zones as price develops.
• Separate bullish SSL sweep events from bearish BSL sweep events.
• Use liquidity sweeps as an additional confirmation within an existing trading strategy.
• Combine liquidity information with market structure, trend analysis, support/resistance, FVGs, order blocks, or other ICT/SMC concepts.
• Create TradingView alerts for detected liquidity sweep events.
• Reduce manual chart marking by automatically detecting and managing liquidity zones.
IMPORTANT:
This indicator identifies liquidity and sweep conditions based on the rules implemented in the script. A liquidity sweep signal should not automatically be treated as a guaranteed buy or sell signal. Traders should use proper risk management and combine the indicator with their own market analysis and trading methodology.
The script is provided for educational and informational purposes only and does not constitute financial, investment, or trading advice.
อินดิเคเตอร์

KevindicatorMTF Supply & Demand Zones
A multi-timeframe supply and demand zone indicator that scans the chart's own timeframe and every higher timeframe you enable (15m through 1D) and automatically draws zones based on a strict base-candle → impulse → follow-through pattern.
How zones are detected:
Demand: a small-bodied red base candle with a lower rejection wick, followed by a visibly large green impulse candle (measured against ATR-14) that closes above the base, with no candle closing back inside the zone during the continuation window.
Supply: the mirror image — a small-bodied green base candle with an upper rejection wick, followed by a visibly large red impulse candle that closes below the base.
Zones are boxed from the base candle's open to its wick extreme, and only wicks (not closes) may re-enter the zone while it's forming.
Zone management:
Zones extend live until broken by a 15-minute close through the zone.
Overlap suppression: when a new zone would sit on top of an existing, still-active zone in the same direction, the lower-timeframe zone is dropped — either the new one is skipped, or the older lower-TF zone is replaced by the new higher-TF one. This keeps the chart from filling up with redundant stacked boxes across timeframes.
Auto-hide broken zones: once a zone breaks, it's automatically removed from the chart after a user-set number of hours (1–72), so invalidated zones don't clutter historical price action.
Inputs:
Toggle which timeframes to scan (15m, 30m, 90m, 1H, 2H, 4H, Daily)
Detection sensitivity (base body size, wick size, impulse strength vs. ATR, continuation candle count)
Zone cleanup controls (overlap % threshold, broken-zone hide duration)
Display options (colors, transparency, timeframe labels, 50% equilibrium line, distance-based hiding, alerts on new zone formation) อินดิเคเตอร์

Adaptive Structure Support & ResistanceChinese description is provided below. Chinese readers, please scroll down to read.
A structure-based support and resistance framework using confirmed pivots, price clustering, adaptive search ranges, historical reaction analysis and post-break role reversal.
1. What is this indicator?
Adaptive Structure Support & Resistance is a market-structure tool designed to identify the support and resistance areas that are currently most relevant to price.
The purpose of this script is not to display every historical swing high and swing low.
Instead, it attempts to answer a more practical question:
Among all historical turning points, which price areas still have enough structural significance to matter to the current market?
The script therefore treats support and resistance as a multi-stage structural problem.
The complete process is:
Identify confirmed swing highs and swing lows.
Merge nearby turning points into structural price clusters.
Evaluate the historical importance of each cluster.
Determine how far above and below the current price the model needs to search.
Select the most relevant support and resistance structures.
Evaluate the historical strength of the selected structures.
Convert exact levels into practical support/resistance zones.
Track what happens after a confirmed break.
Require a retest or rebound before confirming a support/resistance role reversal.
This means that the script is not simply:
ta.pivothigh(...)
ta.pivotlow(...)
followed by two horizontal lines.
Confirmed pivots are only the raw structural observations. Several additional stages are used before a level becomes the displayed support or resistance.
2. Why was this model designed?
Traditional automatic support/resistance tools often face several practical problems.
Too many levels
If every historical pivot is plotted independently, the chart can quickly become filled with horizontal lines. Many of those lines represent nearly identical prices or structures that are no longer relevant.
A single pivot may not represent a meaningful structure
A temporary local high or low can occur for many reasons. A more meaningful market structure often forms when price reacts around the same area multiple times.
Fixed search distances do not work equally well for every instrument
A low-volatility instrument may have meaningful support only 10–20% below the current price.
A highly volatile or strongly trending instrument may require a much wider historical price range before a significant support or resistance structure appears.
The nearest level is not always the most important level
A minor pivot located very close to current price may be less meaningful than a slightly more distant area that has produced several strong historical reactions.
A breakout does not automatically mean role reversal
Resistance does not necessarily become support simply because price trades above it once.
Likewise, support does not necessarily become resistance immediately after one breakdown.
The model is designed around these problems.
Its goal is therefore not to maximize the number of detected structures, but to reduce historical information into a smaller set of currently relevant structural areas.
3. Where can this indicator be used?
The script is intended for standard price charts where historical swing structure is meaningful.
Typical applications include:
Stocks
Indices
ETFs
Futures
Foreign exchange
Cryptocurrency
Other liquid instruments with usable price history
It can be used on different timeframes, but the meaning of the detected structure changes with the timeframe.
For example:
A support structure on a 15-minute chart describes short-term intraday structure.
A support structure on a daily chart describes a larger swing structure.
A support structure on a weekly chart may represent a long-term structural price area.
The indicator does not automatically convert a lower-timeframe level into a higher-timeframe level.
The displayed support and resistance always belong to the chart timeframe being analyzed.
4. Core principle: confirmed structural pivots
The first stage identifies confirmed pivot highs and pivot lows.
A pivot requires price bars on both sides of the potential turning point.
Representative logic:
float pivotHigh = ta.pivothigh(
high,
pivotLeftBarsInput,
pivotRightBarsInput)
float pivotLow = ta.pivotlow(
low,
pivotLeftBarsInput,
pivotRightBarsInput)
The important word here is confirmed .
A newly formed high is not immediately considered a structural resistance observation.
A newly formed low is not immediately considered a structural support observation.
The model waits for the configured number of right-side bars before confirming the pivot.
The intention is to sacrifice some immediacy in exchange for more stable structural observations.
This also means that pivot detection naturally contains confirmation delay.
That delay is part of the methodology rather than an attempt to predict a turning point before it exists.
5. Core principle: price clustering
Multiple pivots occurring around similar prices should not necessarily be treated as unrelated horizontal levels.
For this reason, the script groups nearby pivot observations into price clusters.
Conceptually:
float distancePercent =
math.abs(price - clusterPrice) /
clusterPrice *
100.0
if distancePercent <= mergePercent
matchingIndex := clusterIndex
If several historical lows occur around approximately the same area, they can contribute to one support structure.
The same process applies to historical highs when building resistance structures.
This changes the interpretation from:
"Price touched 12.01, 12.05 and 12.09."
to:
"Price has repeatedly reacted around the same structural area."
The cluster center is updated using the accumulated structural contribution of its observations rather than simply keeping the first pivot price.
6. Core principle: structural ranking
Not every cluster deserves the same importance.
Each pivot contributes a base structural score that incorporates relative volume participation and recency.
A simplified representation of the calculation is:
float pivotBaseScore =
1.0 +
volumeWeightInput * volumeRatio +
recencyWeightInput * recencyFactor
When several pivots belong to the same cluster, their contributions accumulate.
After the candidate clusters have been created, the model evaluates structures within the active search range.
The final ranking also gives a limited preference to structures nearer the current price:
float candidateRank =
accumulatedBaseScore +
proximityBonusInput *
proximityFactor
Proximity is therefore useful, but it is not the entire model.
A level is not selected only because it is the nearest pivot.
7. Relative volume participation
Historical price reactions can contain different levels of market participation.
For each pivot observation, volume is compared with its recent average.
Representative logic:
float volumeRatio =
pivotAverageVolume > 0.0
? math.min(
pivotVolume / pivotAverageVolume,
3.0)
: 1.0
Higher relative volume can contribute additional structural weight.
However, volume is only one component.
The model does not assume that high volume by itself automatically creates support or resistance.
8. Historical reaction analysis
A structural level is more informative when historical interactions with that area produced meaningful price responses.
For a support pivot, the model measures the maximum upside response after the confirmed low during a configurable observation window.
Conceptually:
float reactionPercent =
(highestPostPivotPrice / pivotPrice - 1.0) *
100.0
For resistance, the opposite calculation is used:
float reactionPercent =
(pivotPrice - lowestPostPivotPrice) /
pivotPrice *
100.0
This allows the model to distinguish between two different situations.
A level that price touched repeatedly but barely reacted to.
A level where historical interaction repeatedly produced meaningful rejection or recovery.
These situations are not treated as structurally equivalent.
9. Why the search range is adaptive
One of the main design features of this script is that support and resistance do not have to use the same fixed search distance.
A fixed 25% range can work well for one instrument but fail on another.
A fixed 100% range may capture important historical structures, but can also introduce unnecessarily distant structures when meaningful nearby levels already exist.
The Auto mode therefore uses progressive search tiers.
25%
50%
75%
100%
The algorithm first asks whether the nearest tier contains a structure that satisfies minimum structural requirements.
If it does, the search can stop.
If it does not, the model expands to the next tier.
Representative logic:
if distancePercent <= 25.0
result := 25.0
else if distancePercent <= 50.0 and maximumRangePercent >= 50.0
result := 50.0
else if distancePercent <= 75.0 and maximumRangePercent >= 75.0
result := 75.0
else if distancePercent <= 100.0 and maximumRangePercent >= 100.0
result := 100.0
The important feature is that support and resistance are evaluated independently .
For example:
Support search range: 25%
Resistance search range: 75%
This can occur when a meaningful support structure exists close below price, while the next meaningful resistance structure is much farther above the market.
10. The model does not stop at the first nearby pivot
Adaptive search would not be useful if any small nearby pivot could immediately stop expansion.
The model therefore requires a nearby structure to satisfy minimum quality conditions.
Conceptually:
bool qualifiedStructure =
touchCount >= minimumStructureTouchesInput and
structureQuality >= adaptiveQualityThreshold
Only a qualified structure can stop the search from expanding to the next distance tier.
This prevents a minor local pivot from automatically hiding a larger and more meaningful historical structure.
11. Volatility-aware search adjustment
Volatility also affects how much evidence is required from nearby structures.
ATR is converted into a percentage of price:
float currentAtrPercent =
close > 0.0
? averageTrueRange / close * 100.0
: 0.0
When volatility is high, the minimum structural-quality requirement is increased moderately.
Representative logic:
if currentAtrPercent >= 6.0
adaptiveQualityThreshold :=
minimumStructureQualityInput + 8.0
else if currentAtrPercent >= 4.0
adaptiveQualityThreshold :=
minimumStructureQualityInput + 5.0
The purpose is not simply:
Higher volatility = wider search range.
Instead:
Higher volatility = minor nearby structures need stronger evidence before they are allowed to stop the search.
This distinction is important.
Volatility assists the structural search; it does not independently determine support or resistance.
12. Structural quality used by adaptive search
To decide whether search expansion can stop, a separate quality model evaluates candidate clusters.
The quality assessment combines several components:
Number of structural interactions
Average historical reaction
Relative volume participation
Recency
Accumulated structural contribution
A simplified representation is:
float structureQuality =
touchComponent +
reactionComponent +
volumeComponent +
recencyComponent +
baseScoreComponent
The result is bounded to a 0–100 scale.
clampValue(
structureQuality,
0.0,
100.0)
This quality score primarily answers:
"Is this structure meaningful enough for the adaptive search to stop here?"
It is separate from the final displayed strength score.
13. Selecting the final support and resistance
After the adaptive search distance has been determined, the model evaluates all valid clusters inside that range.
For support:
The cluster must be below or near the current price.
It must remain inside the active support search range.
Its structural score is combined with a proximity adjustment.
For resistance, the same process is applied above current price.
The highest-ranked candidate becomes the primary structural level.
This means that the displayed level represents the outcome of:
confirmed pivots → clustering → structural scoring → adaptive distance selection → final ranking
rather than simply selecting the latest high or low.
14. Strength score: what does 0–100 mean?
After the primary support and resistance levels are selected, the model performs a second evaluation.
This stage describes the historical quality of the selected structure .
The strength score considers:
Touch count
Average reaction after historical interactions
Relative volume participation
Recency
Repeated crossings of the level
Fast failed breaks
The positive components are conceptually:
float rawStrengthScore =
touchComponent +
reactionComponent +
volumeComponent +
recencyComponent +
stabilityComponent -
totalPenalty
Repeated crossings reduce the score:
float totalPenalty =
crossingCount *
crossingPenaltyInput +
failedBreakCount *
failedBreakPenaltyInput
The final value is limited to 0–100.
The interface converts it into:
Weak
Medium
Strong
The score should not be interpreted as:
82 points = 82% probability that support will hold.
It does not represent probability, expected return or strategy win rate.
It is a normalized description of historical structural behavior.
15. Why repeated crossings reduce strength
A price level may appear frequently in historical data simply because the market traded through it many times.
That does not necessarily make the level stronger.
A structurally useful support or resistance area usually produces some degree of rejection, recovery or directional response.
For this reason, the script counts repeated close-to-close crossings.
Representative logic:
bool crossedAbove =
olderClose <= level and
newerClose > level
bool crossedBelow =
olderClose >= level and
newerClose < level
if crossedAbove or crossedBelow
crossingCount += 1
Frequent crossings therefore reduce structural strength instead of increasing it automatically.
16. Why support and resistance are displayed as zones
Real market structure rarely operates at one mathematically exact tick.
Several pivots may occur at slightly different prices while still representing the same area.
The script therefore displays:
A center structural level
A surrounding structural zone
Zone width contains two elements.
First, the actual spread of the clustered pivot prices.
Second, a small volatility-sensitive padding:
float zonePadding =
math.max(
selectedLevel *
minimumZoneWidthPercentInput /
100.0,
averageTrueRange *
atrZoneMultiplierInput)
The center line is useful for reference.
The surrounding area is intended to represent the broader price region where structural interaction may occur.
17. Breakout detection uses the previous structure
There is an important implementation detail in breakout detection.
When price breaks resistance, the current resistance calculation may immediately change because current price itself has changed.
If breakout detection used only the newly recalculated structure, the model could lose the level that price actually broke.
The script therefore references the previously confirmed zone:
float previousResistanceZoneUpperBound =
resistanceZoneUpperBound
float resistanceBreakTrigger =
previousResistanceZoneUpperBound *
(1.0 +
breakoutBufferPercentInput /
100.0)
The same principle applies to support breakdowns.
This allows the structural state machine to remember the actual area involved in the break.
18. Resistance does not immediately become support
A confirmed break starts a new structural state.
The model uses named states internally:
const int STATE_NORMAL = 0
const int STATE_BREAKOUT_WAITING_RETEST = 1
const int STATE_RESISTANCE_TO_SUPPORT = 2
const int STATE_BREAKDOWN_WAITING_REBOUND = -1
const int STATE_SUPPORT_TO_RESISTANCE = -2
After resistance is broken:
The previous resistance area is stored.
The model enters a "waiting for retest" state.
Price is monitored for a return toward the old resistance.
If the retest holds, the former resistance may become support.
If price falls back through the old zone, the breakout is treated as failed.
Representative confirmation logic:
bool testedFormerResistance =
low <=
roleReversalUpperBound *
(1.0 +
retestTolerancePercentInput /
100.0)
bool retestHeld =
testedFormerResistance and
close > roleReversalUpperBound
Only after this process can the old resistance be promoted to support.
19. Support-to-resistance uses the opposite process
After support is broken:
The previous support area is stored.
The model waits for a rebound.
Price must test the former support area.
If price is rejected and cannot recover the area, the former support can become resistance.
Representative logic:
bool testedFormerSupport =
high >=
roleReversalLowerBound *
(1.0 -
retestTolerancePercentInput /
100.0)
bool reboundRejected =
testedFormerSupport and
close < roleReversalLowerBound
This creates a distinction between:
price crossed a level
and:
the market actually completed a structural role reversal.
20. Failed breakout and failed breakdown
The script also monitors invalidation after a break.
If resistance is broken but price quickly returns below the former resistance structure, the event can be treated as a failed breakout.
If support is broken but price quickly recovers the former support structure, the event can be treated as a failed breakdown.
These events reset the pending role-reversal process rather than automatically promoting the old structure to a new role.
21. How to use the indicator
A simple workflow is:
Locate the current support
Identify the support area below the current market.
This is the structural area currently considered most relevant by the model.
Locate the current resistance
Identify the active structural resistance above price.
Read the strength
A stronger score indicates that the selected structure has historically shown better structural characteristics under this model.
It does not mean the level cannot break.
Read "Why this level?"
The dashboard shows the number of historical structural interactions and the average subsequent reaction.
This gives a plain-language explanation for why the level has been selected.
Check how far the algorithm searched
For example:
"Below 25% | Above 75%"
means that qualified support was available relatively close below current price, while the model had to inspect a much wider area to find qualified resistance.
Observe the current structural state
The dashboard may report states such as:
"Price is between support and resistance"
"Resistance broken; waiting for a retest"
"Former resistance is currently acting as support"
"Support broken; waiting for a rebound"
"Former support is currently acting as resistance"
22. Practical interpretation
The indicator is designed primarily as a context tool .
For example:
Price approaching strong support does not automatically mean "buy".
It means price is entering an area that has meaningful structural evidence and may deserve closer observation.
Likewise:
Price approaching resistance does not automatically mean "sell".
It identifies an area where historical supply or rejection has been structurally significant.
A trader can then combine that context with his or her own analysis of:
Price action
Volume
Trend
Market regime
Higher-timeframe structure
Risk/reward
Position sizing
Independent fundamental or macro analysis
The script itself does not generate automatic buy or sell orders.
23. Dashboard explanation
The dashboard intentionally avoids exposing every internal statistical variable.
Instead, it translates the model into simpler trading language.
Support
Current selected support level and its strength evaluation.
Why this level?
Shows how many historical structural interactions contributed to the area and the average subsequent upside response.
Resistance
Current selected resistance level and strength evaluation.
Why this level?
Shows historical interactions and the average subsequent downside response.
How far it searched
Shows the active adaptive search range below and above the current market.
Current state
Explains whether price remains between the structures, has broken one of them, is waiting for confirmation, or has completed a role reversal.
24. Main settings
Lookback Bars
Controls how much historical price data is considered when constructing structural clusters.
A longer lookback includes more historical structure but may also retain older information.
Pivot Left Bars / Pivot Right Bars
Control how strict pivot confirmation is.
Larger values generally identify larger structural turns but require more confirmation.
Price Cluster Width %
Controls how close two pivot observations must be before they can belong to the same structural area.
Search Mode
Auto allows support and resistance to determine their own search distances.
Manual uses a fixed maximum distance.
Maximum Auto Range
Defines the maximum distance the adaptive search is allowed to inspect.
Minimum Structure Quality
Controls how meaningful a structure must be before it can stop automatic search expansion.
Minimum Valid Tests
Defines the minimum number of structural observations required for a candidate to qualify during adaptive search.
Reaction Observation Bars
Defines how many bars after a historical pivot are examined when measuring its subsequent price reaction.
Break Confirmation Buffer
Adds a small margin beyond the old structural zone before a break is considered confirmed.
Retest Tolerance
Controls how close price must return to the former structural area during retest/rebound evaluation.
25. Alerts
Alert conditions are provided for:
Resistance break
Support break
Resistance confirmed as support
Support confirmed as resistance
Failed breakout
Failed breakdown
When close confirmation is enabled, structural break events are evaluated on confirmed bars.
26. About repainting and structural updates
This script should not be interpreted as a system that predicts pivots before they are confirmed.
Pivot highs and lows require right-side confirmation bars.
Therefore:
A newly forming pivot is not shown as confirmed structure until sufficient bars exist to confirm it.
Once new market data arrives, the active support and resistance can still change for legitimate structural reasons.
Examples include:
A new confirmed pivot enters the calculation.
Several new observations create a stronger price cluster.
Current price moves enough to change the relevant search region.
An older observation exits the configured lookback window.
A breakout creates a role-reversal state.
This is dynamic structural recalculation, not a promise that current support and resistance will remain fixed forever.
27. Why these components belong together
This script combines several concepts, but they are not independent indicators placed together for convenience.
Each component solves a different stage of the same problem.
Confirmed pivots identify potential structural observations.
Price clustering converts nearby observations into common price areas.
Structural ranking determines which areas contain more meaningful historical evidence.
Adaptive search determines how far the model needs to inspect for an adequate structure.
Reaction analysis measures how price historically responded to that structure.
Strength evaluation summarizes the historical quality of the selected area.
ATR-based zone construction converts an exact center price into a practical market area.
The role-reversal state machine manages what happens after the structure is broken.
The components are therefore sequential stages of one structural support/resistance framework rather than a mashup of unrelated indicators.
28. What is distinctive about this implementation?
The primary design characteristics of this implementation are:
Nearby pivots are aggregated into structural price clusters rather than displayed independently.
Support and resistance use independent adaptive search ranges.
Search expansion depends on structural quality rather than distance alone.
Volatility modifies the evidence required from nearby structures.
Level selection and level-strength evaluation are deliberately separated.
Repeated crossings and failed breaks can reduce structural strength.
Support and resistance are represented as price areas instead of exact single-price barriers.
Break detection references the previous structural zone.
Role reversal requires confirmation through a state machine instead of occurring immediately after a single crossing.
The chart intentionally focuses on the current relevant structure rather than filling the chart with historical event markers.
29. Limitations
No support/resistance algorithm can know with certainty whether a level will hold or fail.
Important limitations include:
Pivot confirmation introduces intentional delay.
Support and resistance may change as new information becomes available.
Historical reaction does not guarantee future reaction.
A high strength score is not a probability of success.
Very new instruments with limited history may not contain enough structural observations.
Strong trend transitions can invalidate historical structures quickly.
Volume-based components depend on the quality and meaning of the instrument's volume data.
Different timeframes can produce materially different support and resistance structures.
Synthetic or non-standard chart types may use transformed OHLC values and can therefore produce different structural results.
30. Final note
Support and resistance should be understood as areas of market interaction, not guaranteed turning points.
The purpose of this indicator is to organize historical structure and reduce it into a small number of currently relevant price areas.
It is an analytical framework, not an automatic trading system.
This script is intended for market-structure analysis and educational use. It does not constitute investment advice, a recommendation, or a guarantee of future market performance.
────────────────────────────────────
中文说明
1. 这个指标是什么?
Adaptive Structure Support & Resistance 是一个基于市场历史结构,自动寻找当前价格上下方关键支撑与压力区域的分析工具。
它解决的并不是:
“历史上哪里出现过高点和低点?”
而是试图解决一个更实际的问题:
“历史上这么多高低点里,哪些价格区域到现在仍然具有足够的结构意义,值得当前继续关注?”
所以,这个指标不是简单地把每一个 Pivot High 和 Pivot Low 都画成水平线。
完整计算过程包括:
识别已经确认的历史高低结构。
把价格相近的多个结构合并成一个价格簇。
评价不同价格簇的历史结构意义。
分别判断寻找支撑和压力到底需要看多远。
从有效搜索范围中选择当前更重要的支撑与压力。
评价被选中位置过去的实际价格反应。
将精确价格转化为更加符合实际交易的撑压区域。
价格突破或跌破以后保存原结构。
通过回踩或反抽确认撑压角色是否真正发生转换。
因此,Pivot 只是整个模型的第一步,而不是最终结果。
2. 为什么要做这套模型?
传统的自动支撑压力工具经常存在几个问题。
画出来的线太多
如果把每个前高前低全部保留下来,时间稍长以后主图会出现大量水平线。
不仅影响阅读,而且其中很多价格其实属于同一个结构。
单个高低点不一定有意义
市场临时出现一个局部最高点或最低点,并不能说明这个价格一定存在真正的供需结构。
如果不同时间价格多次来到相近区域并产生反应,它所代表的结构意义通常更加完整。
不同标的不能使用完全相同的搜索距离
有些股票距离现价下方 20% 就存在非常明确的历史结构。
有些高波动、长期趋势较强的股票,却可能需要向下或者向上看 50%、75% 甚至更远,才能找到真正有意义的位置。
距离最近的不一定最重要
现价附近可能存在一个很小的 Pivot,但稍微远一点的位置可能历史上被多次验证,并且每次都出现较大价格反应。
突破并不等于立刻完成撑压转换
突破压力一次,不应该马上认为压力已经变成支撑。
跌破支撑一次,也不应该马上认为原支撑已经成为新压力。
所以这套模型的设计目标不是“尽量多找线”。
而是:
尽量把复杂的历史价格结构压缩成少量、当前更值得关注的支撑和压力区域。
3. 可以用在哪里?
只要历史价格结构具有一定参考意义,理论上都可以使用,例如:
股票
指数
ETF
期货
外汇
加密资产
其他具有正常历史行情数据的流动性标的
不同周期看到的是不同级别的结构。
例如:
15分钟图得到的是偏短线结构。
日线得到的是波段级结构。
周线得到的是更长期的历史结构。
指标不会把15分钟的支撑自动解释成日线支撑。
所有计算都基于当前图表所使用的周期。
4. 第一步:确认历史结构高低点
模型首先通过已经确认的 Pivot High 与 Pivot Low 获取历史结构观察点。
核心逻辑:
float pivotHigh = ta.pivothigh(
high,
pivotLeftBarsInput,
pivotRightBarsInput)
float pivotLow = ta.pivotlow(
low,
pivotLeftBarsInput,
pivotRightBarsInput)
这里最重要的是“确认”。
一个刚刚形成的高点不会马上成为正式压力结构。
一个刚刚形成的低点也不会马上成为正式支撑结构。
需要等待右侧一定数量的K线完成确认。
所以模型主动接受一定的确认延迟,用来减少把尚未成立的短期极值直接当成重要结构的情况。
5. 第二步:把相近价格合并成一个结构
如果历史上存在:
12.01
12.05
12.09
这三个低点,实际上它们很可能描述的是同一片支撑区域,而不是三条完全独立的支撑线。
所以系统会计算不同 Pivot 之间的价格距离:
float distancePercent =
math.abs(price - clusterPrice) /
clusterPrice *
100.0
if distancePercent <= mergePercent
matchingIndex := clusterIndex
如果距离足够接近,就把它们合并到同一个价格结构中。
这样模型关注的就不再是:
“12.01碰过一次”
而是:
“12元附近这个区域历史上反复出现过结构反应。”
6. 第三步:给历史结构进行初步排序
并不是所有 Pivot 对结构的重要性都一样。
模型会考虑:
当时成交量相对大小
这个结构距离现在有多久
多个 Pivot 是否属于同一个价格区域
基础贡献大致表现为:
float pivotBaseScore =
1.0 +
volumeWeightInput * volumeRatio +
recencyWeightInput * recencyFactor
多个相近 Pivot 被合并后,它们的结构贡献会累积。
最后选择当前结构时,还会给予距离现价较近的位置一定加分:
float candidateRank =
accumulatedBaseScore +
proximityBonusInput *
proximityFactor
但这里需要注意:
“距离近”只是一个因素,并不是谁离现价最近就一定选择谁。
7. 成交量在这里做什么?
模型会把 Pivot 当时的成交量与近期平均成交量进行比较。
例如:
float volumeRatio =
pivotAverageVolume > 0.0
? math.min(
pivotVolume / pivotAverageVolume,
3.0)
: 1.0
如果某个结构形成时伴随更明显的市场参与,它可以得到额外权重。
但是成交量并不会单独决定支撑压力。
它只是结构评价中的一个辅助信息。
8. 历史触碰以后到底有没有真正反应?
一个位置历史上碰过很多次,并不代表它一定很重要。
关键还要看:
碰到以后,价格到底有没有发生真正的反向运动?
对于历史支撑 Pivot,系统观察之后一定K线范围内出现的最大向上反应。
核心思想:
float reactionPercent =
(highestPostPivotPrice / pivotPrice - 1.0) *
100.0
对于历史压力,则计算后续最大回落:
float reactionPercent =
(pivotPrice - lowestPostPivotPrice) /
pivotPrice *
100.0
这样能够区别:
一个历史上经常出现,但价格几乎没有明显反应的位置。
一个每次靠近以后,价格都出现较明显反转或回撤的位置。
9. 为什么搜索距离必须智能调整?
这是这个模型比较重要的一部分。
固定使用25%的搜索范围并不适合所有标的。
固定使用100%,又可能在不必要的情况下把非常遥远的历史结构纳入计算。
所以自动模式采用:
25%
50%
75%
100%
逐级寻找。
核心映射逻辑:
if distancePercent <= 25.0
result := 25.0
else if distancePercent <= 50.0 and maximumRangePercent >= 50.0
result := 50.0
else if distancePercent <= 75.0 and maximumRangePercent >= 75.0
result := 75.0
else if distancePercent <= 100.0 and maximumRangePercent >= 100.0
result := 100.0
如果25%以内已经存在合格结构,就可以停止。
如果没有,就扩大到50%。
依次类推。
10. 支撑和压力是分别搜索的
支撑和压力并不会强制使用同一个范围。
完全可能出现:
下方支撑搜索:25%
上方压力搜索:75%
它表达的意思是:
下方距离现价比较近的地方已经存在足够明确的历史支撑结构。
但是上方近距离没有达到要求的压力,所以模型继续向更远的位置寻找。
11. 为什么不是25%以内随便有个Pivot就停止?
如果只要附近出现一个 Pivot 就停止寻找,所谓智能搜索就没有意义。
因此,候选结构必须同时满足最低触碰次数和最低结构质量。
例如:
bool qualifiedStructure =
touchCount >= minimumStructureTouchesInput and
structureQuality >= adaptiveQualityThreshold
这意味着:
附近有结构 ≠ 附近有足够好的结构。
如果近端只是一个很弱的小级别价格点,系统仍然可以继续扩大搜索范围。
12. 波动率为什么也参与?
系统使用 ATR 相对于当前价格的比例观察标的自身波动程度。
float currentAtrPercent =
close > 0.0
? averageTrueRange / close * 100.0
: 0.0
高波动股票附近出现小 Pivot 非常正常。
因此,对于高波动标的,系统会适当提高“附近结构足够好”的要求。
例如:
if currentAtrPercent >= 6.0
adaptiveQualityThreshold :=
minimumStructureQualityInput + 8.0
else if currentAtrPercent >= 4.0
adaptiveQualityThreshold :=
minimumStructureQualityInput + 5.0
这里不是:
“ATR越高,搜索距离一定越远。”
而是:
“波动越高,附近的小结构必须更有说服力,才能阻止系统继续向外寻找。”
13. 智能搜索中的结构质量怎么计算?
用于决定“是否还要继续扩大搜索范围”的结构质量,主要包含:
历史触碰次数
触碰后的平均反应
相对成交量
结构新旧程度
多个结构累积后的基础得分
可以简化理解为:
float structureQuality =
touchComponent +
reactionComponent +
volumeComponent +
recencyComponent +
baseScoreComponent
最后压缩到0–100:
clampValue(
structureQuality,
0.0,
100.0)
这个分数主要解决的是:
“这个位置够不够好,好到可以不用继续向外找了?”
14. 最终支撑压力怎么选?
确定搜索范围以后,系统会重新检查范围内所有候选结构。
支撑必须位于现价下方或附近。
压力必须位于现价上方或附近。
最后比较:
历史结构累积得分
与当前价格的距离
选择当前 Rank 更高的结构。
所以最终看到的线经历了:
Pivot确认
→ 相近价格聚类
→ 结构评价
→ 智能搜索距离
→ 范围内重新排序
→ 最终支撑压力
15. 0–100强度分数到底是什么意思?
当最终支撑压力确定以后,系统会再做一次独立评价。
这一部分不是用来重新选择线,而是告诉你:
“现在已经选中的这条结构,历史质量到底怎么样?”
主要考虑:
触碰次数
历史平均反应
相对成交量
结构是否较新
是否经常被来回穿越
是否出现过快速失败突破
大致计算结构:
float rawStrengthScore =
touchComponent +
reactionComponent +
volumeComponent +
recencyComponent +
stabilityComponent -
totalPenalty
其中反复穿越和失败突破会扣分:
float totalPenalty =
crossingCount *
crossingPenaltyInput +
failedBreakCount *
failedBreakPenaltyInput
最后得到0–100,并转化成:
弱
中
强
但是一定不要理解成:
“82分 = 未来82%概率守住。”
它不是胜率,也不是未来预测概率。
它只是对历史结构质量进行标准化后的评分。
16. 为什么反复穿越反而扣分?
有些价格历史上出现很多次,仅仅是因为市场一直在这个位置上下震荡。
如果价格能够非常轻松地不断穿过这个位置,它未必是真正强支撑或强压力。
所以系统统计价格穿越中心结构的情况:
bool crossedAbove =
olderClose <= level and
newerClose > level
bool crossedBelow =
olderClose >= level and
newerClose < level
穿越越频繁,结构稳定性评价越低。
17. 为什么画的是区域,不只是一条线?
真实交易中,很少存在一个价格精确到最小报价单位以后永远有效。
历史多个 Pivot 本身就可能分布在一个小区间里。
所以模型保留:
中心结构价格
结构区域
区域宽度由:
历史 Pivot 聚类本身的价格范围
少量 ATR 波动缓冲
共同决定。
核心思想:
float zonePadding =
math.max(
selectedLevel *
minimumZoneWidthPercentInput /
100.0,
averageTrueRange *
atrZoneMultiplierInput)
中心线用于定位。
阴影区域用于表达真实市场中的价格博弈带。
18. 为什么突破使用上一根K线的压力?
这是结构判断里很重要的一点。
当价格突破压力以后,如果马上重新计算当前压力,那么旧压力可能已经被系统替换。
这样反而不知道价格刚刚突破的到底是哪一个结构。
所以突破判断使用突破之前已经存在的压力区域:
float previousResistanceZoneUpperBound =
resistanceZoneUpperBound
并基于它计算突破标准:
float resistanceBreakTrigger =
previousResistanceZoneUpperBound *
(1.0 +
breakoutBufferPercentInput /
100.0)
支撑跌破同理。
19. 突破压力以后为什么不能马上变成支撑?
系统内部使用一个状态机:
const int STATE_NORMAL = 0
const int STATE_BREAKOUT_WAITING_RETEST = 1
const int STATE_RESISTANCE_TO_SUPPORT = 2
const int STATE_BREAKDOWN_WAITING_REBOUND = -1
const int STATE_SUPPORT_TO_RESISTANCE = -2
突破压力以后:
保存原来的压力区域。
进入“等待回踩”状态。
观察价格是否重新回来测试原压力。
如果回踩以后守住,才确认压力转支撑。
如果重新跌回原结构下方,则视为突破失败。
回踩逻辑类似:
bool testedFormerResistance =
low <=
roleReversalUpperBound *
(1.0 +
retestTolerancePercentInput /
100.0)
bool retestHeld =
testedFormerResistance and
close > roleReversalUpperBound
20. 支撑转压力同样需要确认
支撑跌破以后:
保存原来的支撑。
等待价格反抽。
观察反抽是否重新接触原支撑区域。
如果无法重新站回,才确认原支撑变成压力。
例如:
bool testedFormerSupport =
high >=
roleReversalLowerBound *
(1.0 -
retestTolerancePercentInput /
100.0)
bool reboundRejected =
testedFormerSupport and
close < roleReversalLowerBound
因此模型会区分:
“价格只是穿过了一下”
与:
“原来的市场结构真正完成了角色转换”
21. 实际怎么使用?
最简单的使用顺序:
先看支撑在哪里
这是当前算法认为下方更值得关注的历史结构区域。
再看压力在哪里
这是当前上方更值得关注的历史结构区域。
看强度
强度越高,代表这个结构在模型评价中具有更好的历史表现。
但再强也可能被突破。
看“为什么是它?”
这里会直接告诉你历史上大致碰过多少次,以及碰到以后平均出现多大的反向运动。
看“算法看了多远”
例如:
下方25%|上方75%
意味着下方较近就找到了合格支撑,但是上方需要看更远,才找到合格压力。
最后看“现在怎么看”
这里会告诉你目前属于:
价格仍在支撑压力之间;
突破压力等待回踩;
原压力已经转为支撑;
跌破支撑等待反抽;
原支撑已经转为压力;
等结构状态。
22. 应该如何理解支撑压力?
这个指标最适合作为“位置和结构背景工具”。
例如:
价格到了强支撑,不等于自动买入。
它代表价格已经进入一个历史结构相对重要的位置,值得进一步观察。
同样:
价格到了强压力,也不等于必须卖出。
它代表价格进入过去曾经出现明显供给或回落反应的区域。
后续仍然可以结合自己的:
价格行为
成交量
趋势结构
大周期方向
市场环境
赔率
风险控制
仓位管理
共同判断。
23. 右上角面板怎么看?
我刻意没有把所有内部统计数据全部堆在面板上。
面板只保留实际使用中更容易理解的信息。
支撑位置
当前支撑在哪里,以及它的结构强弱。
为什么是它?
告诉你历史触碰次数和触碰以后平均反弹幅度。
压力位置
当前压力在哪里,以及强弱。
为什么是它?
告诉你历史触碰次数和之后平均回落幅度。
算法看了多远
显示支撑和压力分别使用了多大的搜索范围。
现在怎么看
使用大白话告诉你当前市场与撑压之间处于什么结构状态。
24. 常用参数怎么理解?
Lookback Bars / 回看K线数
决定使用多少历史K线寻找结构。
周期越长,可以考虑更久以前的结构,但也可能保留更多较旧的信息。
Pivot Left / Right Bars
决定 Pivot 判断严格程度。
数值越大,一般意味着只识别更明显的结构转折,同时确认速度也会更慢。
Price Cluster Width %
决定两个历史 Pivot 相差多少以内可以被认为属于同一结构。
Search Mode
Auto:自动决定支撑和压力分别要搜索多远。
Manual:手动固定搜索范围。
Maximum Auto Range
智能搜索允许向外扩展到的最大距离。
Minimum Structure Quality
决定附近结构必须达到多高质量,才能让系统停止继续扩大搜索。
Minimum Valid Tests
智能搜索中,一个结构至少需要多少次历史观察才能成为有效候选。
Reaction Observation Bars
计算历史 Pivot 出现以后,向后观察多少根K线的价格反应。
Break Confirmation Buffer
突破原撑压区域以后,需要额外超过多少缓冲才认定为有效突破。
Retest Tolerance
回踩或反抽过程中,允许价格距离原结构存在多大误差。
25. 警报
指标支持以下 Alert:
有效突破压力
有效跌破支撑
压力确认转支撑
支撑确认转压力
突破失败
跌破失败
如果启用了收盘确认,那么对应结构事件会等待K线确认以后判断。
26. 关于重绘和结构变化
这个指标不是提前预测 Pivot 的工具。
Pivot 本身必须等待右侧K线确认。
因此:
刚刚形成的最高点或最低点,不会在尚未确认时被当成已经成立的正式结构。
但是当前支撑压力未来仍然可能发生变化。
原因包括:
新的 Pivot 被确认。
新的历史触碰让另一个价格簇变得更重要。
现价移动以后,当前最相关的结构发生变化。
旧数据离开回看范围。
价格突破以后发生撑压角色转换。
这是动态结构模型正常的重新评价过程。
27. 为什么这些模块必须放在一起?
虽然指标中包含多个计算部分,但它们并不是几个无关指标简单拼接。
每一个部分都负责解决同一个支撑压力问题中的不同阶段。
Pivot :找出可能的历史结构观察点。
价格聚类 :把相近观察点合并成真正的价格区域。
结构排序 :判断哪些区域具有更多历史证据。
智能搜索 :判断为了找到有效结构到底需要看多远。
历史反应 :判断价格过去触碰以后是否真的产生明显反应。
强度评分 :评价最终选中结构过去的整体质量。
ATR区域 :把一个中心价格转化为更加符合实际市场的撑压带。
状态机 :处理结构突破以后,到底是真突破、失败突破还是完成撑压转换。
因此:
这是一条连续的结构计算链,而不是把多个独立指标组合到同一个脚本中。
28. 这套实现有什么特点?
主要设计特点包括:
不会把所有 Pivot 独立画线,而是先进行价格聚类。
支撑和压力可以使用完全不同的智能搜索距离。
是否扩大搜索范围由结构质量决定,而不是只有距离。
高波动环境会提高附近小结构的有效要求。
“选哪条线”和“这条线有多强”是两个独立计算阶段。
反复穿越会降低结构评分,而不是因为出现次数多就自动变强。
支撑压力使用区域表达,而不是绝对精确价格。
突破使用之前已经存在的结构,而不是突破以后重新计算出的新位置。
撑压转换必须经过回踩/反抽状态确认。
主图只重点展示当前结构,不保留大量历史突破标签干扰图表。
29. 使用限制
任何支撑压力算法都无法提前确定某个位置未来一定守住或者一定突破。
需要注意:
Pivot 确认天然存在延迟。
随着市场产生新数据,当前支撑压力可能发生变化。
历史上反应明显,不代表未来一定继续反应。
强度分数不是未来成功概率。
刚上市或者历史数据很少的标的可能缺少足够结构样本。
趋势发生巨大变化以后,过去有效的结构可能迅速失效。
成交量相关评价依赖该标的成交量数据本身的有效性。
不同周期得到的撑压位置可以完全不同。
非标准K线可能使用经过转换的 OHLC,因此计算结果可能与真实成交价格图存在差异。
30. 最后
支撑和压力应该被理解为市场可能发生博弈的区域,而不是保证发生反转的价格。
这个指标的核心目标,是把复杂的历史市场结构整理成少量、当前更值得观察的位置。
它是市场结构分析框架,而不是自动交易系统。
本指标仅用于市场结构研究与辅助分析,不构成投资建议、收益承诺或任何形式的买卖推荐。 อินดิเคเตอร์

Adaptive Head and Shoulders Detector█ OVERVIEW
Adaptive Head and Shoulders Detector is a highly configurable pattern-detection indicator designed to automatically identify Classic Head & Shoulders and Inverse Head & Shoulders formations using multiple pivot lengths, structural filters and optional neckline-break confirmation.
Instead of relying on a single fixed pivot sensitivity, the indicator can analyse market structure simultaneously at four different pivot lengths. Each length can have its own requirements for shoulder symmetry and minimum head deviation, allowing the detector to identify both relatively compact formations and larger, more significant structures.
A key feature of the indicator is its multi-pivot architecture. Each enabled pivot length acts as a standalone detector and also feeds the shared history used by Mix Mode. Mix Mode can combine pivots detected at different sensitivities within a single pattern, provided those lengths are enabled. Mix Mode does not run on its own: disabling Pivot 1–4 removes those lengths from both standalone detection and mix detection.
The indicator also uses ATR as a common volatility reference. Shoulder symmetry, head deviation and the required preceding trend impulse are expressed in relation to ATR, allowing the pattern criteria to adapt to the current scale of price movement rather than relying exclusively on fixed price distances.
Pattern quality is evaluated not only by the visual arrangement of the five pivots, but also by the relative height of the head and shoulders, time symmetry between the two sides of the formation, and the existence of a preceding directional move. This allows the detector to filter out structures that resemble Head & Shoulders visually but do not satisfy the defined structural conditions.
The confirmation process can be configured in two ways. In the immediate mode, a pattern is confirmed when the right shoulder pivot becomes confirmed. Alternatively, the user can require a confirmed neckline break, in which case the pattern remains pending until price closes beyond the neckline. Neckline-break confirmation is evaluated only on a closed bar, preventing an intrabar price excursion from triggering a premature confirmation.
Another important element is Pivot Source. The user can build pivots from High/Low wicks or exclusively from closing prices. This changes the structural information used by the detector and allows the indicator to ignore long wicks when a close-based interpretation of market structure is preferred.
The visual layer can be customized independently through pattern colours, neckline colour, labels, fill transparency and label positioning. A trend visualization mode can additionally show the preceding trend leg and its measured strength in ATR units, making the operation of the trend filter easier to understand.
As a result, Adaptive Head and Shoulders Detector can be used both as an automatic pattern scanner and as a structural analysis tool for studying how pivot sensitivity, trend strength, symmetry and neckline confirmation influence pattern detection.
█ CONCEPTS
Head & Shoulders Structure
The indicator identifies the classic five-point Head & Shoulders structure:
* R1 — left shoulder
* B2 — first trough
* HEAD — central extreme
* B4 — second trough
* R5 — right shoulder
For a classic bearish Head & Shoulders, the head forms above both shoulders, while the two troughs create the basis for the neckline.
For an Inverse Head & Shoulders, the structure is reversed: the head forms below both shoulders and the two intermediate highs define the neckline.
The detector requires the pivots to alternate correctly and checks the relative position of all five points before accepting the structure as a valid pattern.
ATR-Based Adaptation
ATR is used as the volatility reference for the main structural tolerances.
Instead of defining shoulder differences or head depth using fixed price values, the indicator expresses these requirements as multiples of ATR. This allows the same settings to behave more proportionally across markets and volatility conditions.
ATR is also used to measure the strength of the preceding trend and to determine the visual offset of labels.
Pivot Detection
The indicator can use up to four independent pivot lengths.
A pivot length defines how many bars on each side of a bar are required before a high or low can be confirmed as a pivot. Smaller lengths detect more frequent and smaller structural turning points, while larger lengths produce fewer but generally more significant pivots.
Each pivot length can be enabled or disabled independently. Enabling a given length starts its standalone detection and also adds its pivots to the Mix Mode history.
Pivot Source
Pivot calculations can be based on either High/Low wicks or closing prices.
* High/Low (wick) — uses the actual highs and lows of candles, allowing long wicks to participate in pivot formation.
* Close — uses closing prices exclusively, effectively ignoring wicks when determining structural pivots.
This setting applies across all pivot lengths and also affects Mix Mode.
Shoulder Symmetry
The detector compares the price levels of the left and right shoulders.
The maximum allowed difference is defined as an ATR multiple. A lower tolerance requires the shoulders to be more closely aligned, while a higher tolerance allows more asymmetric formations.
Each standalone pivot length has its own shoulder tolerance, while Mix Mode uses a separate shared tolerance.
Head Deviation
The head must be sufficiently separated from both shoulders.
For a classic H&S, the head must be above both shoulders by at least the specified ATR distance. For an inverse H&S, the head must be below both shoulders by the required amount.
This prevents shallow structures from being classified as valid Head & Shoulders patterns simply because five alternating pivots happen to form a similar shape.
Time Symmetry
The indicator also evaluates the horizontal proportions of the pattern.
The distance from the left shoulder to the head is compared with the distance from the head to the right shoulder. The maximum permitted ratio is controlled by Max. time asymmetry.
A value closer to 1 requires a more symmetrical formation, while higher values allow one side of the pattern to develop over a longer period than the other.
Preceding Trend Filter
A valid Head & Shoulders formation can optionally be required to follow a sufficiently strong preceding trend.
The indicator searches backward from the left shoulder for the relevant preceding extreme and measures the price movement between that extreme and the left shoulder in ATR units.
For a bearish H&S, the structure should be preceded by an upward impulse. For an inverse H&S, the structure should be preceded by a downward impulse.
Setting the minimum trend impulse to 0 disables this filter.
Neckline Confirmation
The neckline is drawn through the two intermediate pivots of the formation and extended to the right by the selected number of bars.
When neckline-break confirmation is enabled, the pattern is stored as pending after its structure and trend conditions are satisfied. The indicator then waits for a candle close beyond the neckline.
For a classic H&S, confirmation occurs when price closes below the neckline.
For an inverse H&S, confirmation occurs when price closes above the neckline.
The neckline break is checked only on a confirmed candle, so a temporary intrabar penetration does not trigger the confirmation.
Mix Mode
Mix Mode builds a pattern from the most recent points in the shared pivot history, which is created exclusively from the enabled Pivot 1–4 lengths.
Instead of requiring all five points to come from the same pivot length, individual points can originate from different enabled pivot lengths. For example, a single pattern can be constructed from a combination such as 5 / 10 / 15 / 5 / 10 if those lengths are enabled and that is how the current tail of the merged history looks.
Mix Mode does not work without the lengths that feed it: disabling Pivot 1–4 removes those pivots from both standalone detection and mix detection. The user can use standalone detection only, standalone detection together with mix, or mix based only on the currently enabled lengths.
The mixed structure is still subjected to the same core requirements for head deviation, shoulder symmetry, time symmetry and preceding trend strength. The largest pivot length participating in the pattern is used as the reference for trend lookback and breakout waiting time.
█ FEATURES
Common
* ATR Length – defines the number of bars used to calculate ATR, which serves as the volatility reference for the indicator's tolerance and trend thresholds.
* Extend neckline to the right (bars) – specifies how many bars the dashed neckline is extended beyond the current confirmation area.
* Show labels – displays the HEAD and R labels at the relevant pattern points.
* Bull color – defines the colour used for Inverse H&S patterns and bullish signals.
* Bear color – defines the colour used for classic H&S patterns and bearish signals.
* Neckline color – sets the colour of the dashed neckline.
* Label text color – defines the text colour used inside all indicator labels.
* Label size – controls the size of HEAD, R, signal and trend-visualization labels.
* Show direction signal – displays a BULL or BEAR signal when the selected pattern confirmation condition is met.
* Show pattern fill – enables or disables the shaded area representing the detected pattern.
* Fill transparency (%) – controls the transparency of the pattern fill.
* Label offset from price (x ATR) – controls the distance between labels and their corresponding price points, expressed as a multiple of ATR.
* Pivot source – selects whether pivots are calculated from High/Low wicks or closing prices.
Structure / Trend / Confirmation
* Require neckline break confirmation – when enabled, the pattern must be confirmed by a candle close beyond the neckline. When disabled, confirmation occurs when the right-shoulder pivot itself becomes confirmed.
* Trend lookback window (x pivot length) – defines how far back the indicator searches for the preceding trend extreme, based on the pivot length used by the pattern.
* Min. trend impulse before pattern (x ATR) – specifies the minimum preceding price movement required before the pattern, expressed in ATR units. Setting it to 0 disables the trend filter.
* Max. time asymmetry (b1→head vs head→b5) – controls the maximum allowed difference between the time spent developing the left and right sides of the pattern.
* Max. wait time for breakout (x pivot length) – defines how long the indicator waits for a neckline break before discarding a pending pattern as stale. Applies only when neckline-break confirmation is enabled.
* Show trend visualization (line to extreme) – displays the preceding trend leg as a dotted line and shows its measured strength in ATR units.
* ...also for patterns that did NOT pass the trend filter – additionally displays trend visualization for structurally matching patterns that failed the minimum trend requirement, helping with filter calibration.
Pivot 1–4
* Enable pivot X – enables standalone H&S / Inverse H&S detection at that sensitivity and also adds those pivots to the Mix Mode history.
* Pivot X length (left/right) – defines the number of bars on each side required to confirm a pivot.
* Shoulder symmetry tolerance X (x ATR) – defines the maximum permitted price difference between the two shoulders.
* Min. head deviation X (x ATR) – defines the minimum required distance between the head and both shoulders.
Mix Mode
* Enable mix mode (different pivot lengths in one pattern) – enables detection of patterns whose individual points can originate from different enabled pivot lengths. Mix Mode uses only the lengths enabled under Pivot 1–4.
* Shoulder symmetry tolerance (mix, x ATR) – defines the maximum permitted difference between the shoulders of a mixed pattern.
* Min. head deviation (mix, x ATR) – defines the minimum required head deviation for mixed patterns.
* Max. number of pivots in merged history – specifies how many recent pivots from all enabled pivot lengths are retained for mixed-pattern searching.
Alerts
* Inverse H&S (Bullish) Signal – triggers when a bullish Inverse Head & Shoulders signal is generated.
* H&S (Bearish) Signal – triggers when a bearish Head & Shoulders signal is generated.
* H&S / Inverse H&S Signal (Any) – triggers for either a bullish or bearish pattern signal.
█ APPLICATIONS
Multi-Scale Head & Shoulders Detection
Using several pivot lengths allows the indicator to analyse different structural scales simultaneously.
Smaller pivot lengths can capture more local formations, while larger lengths focus on broader market structures. This makes it possible to use one indicator for multiple levels of pattern sensitivity instead of relying on a single pivot configuration.
A detected formation is not a trade signal and does not mark an entry. It is information that a structure has appeared on the chart after which a reversal may be expected. The timing and location of any trade should be determined with other methods or strategies.
█ NOTES
* Pivot-based detection requires the selected number of bars on both sides of a pivot before that pivot can be confirmed. Larger pivot lengths therefore produce slower but generally broader structural detection.
* When neckline-break confirmation is enabled, the pattern is confirmed only after a candle closes beyond the neckline. Intrabar movement through the neckline does not trigger the confirmation.
* Pending patterns that do not receive a neckline break within the configured waiting period are discarded.
* Mix Mode uses only the enabled Pivot 1–4 lengths. The same Enable option feeds both standalone detection and the mix history — a given length cannot be disabled as a standalone detector while still being kept in mix only. อินดิเคเตอร์

TrendFusion Pro | Multi-MA + ADX + KAMA + VWAP Hariss 369A flexible multi-timeframe trend-following indicator designed to identify bullish and bearish market conditions using configurable Moving Average alignment.
The system allows traders to combine up to three Moving Averages, with independent settings for MA type, length and timeframe. Supported MA types include EMA, SMA, WMA, VWMA, RMA and HMA.
Core Features
• Three independently configurable Moving Averages
• EMA, SMA, WMA, VWMA, RMA and HMA support
• Individual timeframe selection for each MA
• Flexible MA alignment logic for BUY and SELL conditions
• Optional DMI/ADX trend-strength filter
• Optional Higher-Timeframe KAMA trend filter
• Optional Higher-Timeframe VWAP filter
• ATR-based dynamic trailing stop
• Separate long and short ATR trailing stops
• BUY and SELL signals with configurable colours
• Alert conditions for BUY and SELL signals
• Clean chart-based trend visualization
How the Trend Logic Works
When multiple MAs are enabled, the indicator looks for price and MA alignment.
For bullish conditions, price must be above the selected MAs and the enabled MAs must be properly aligned from faster to slower.
For bearish conditions, price must be below the selected MAs and the enabled MAs must be aligned in the opposite direction.
The indicator can also require confirmation from:
• DMI/ADX
• Higher-Timeframe KAMA
• Higher-Timeframe VWAP
These filters are optional and can be enabled or disabled according to the trader's methodology.
ATR Trailing Stop
The indicator calculates a dynamic ATR-based trailing stop.
For long conditions, the stop can only move upward as the trend progresses.
For short conditions, the stop can only move downward.
This provides a dynamic way to manage trend-following trades while allowing the trader to adjust ATR length and multiplier according to the market and timeframe.
Suggested Use
The indicator can be used for:
• Trend identification
• Trend-following entries
• Pullback confirmation
• Multi-timeframe market analysis
• Dynamic trailing-stop management
• Alert-based trading workflows
The default configuration uses 20 EMA, 50 EMA and 200 EMA, but these settings are fully customizable.
Different combinations can be tested depending on the instrument, timeframe and trading style.
Important
This indicator is designed as a technical-analysis and decision-support tool. It does not guarantee profitable trades and should not be treated as a standalone trading system.
Always test settings on historical data and in real-time market conditions before using them with real capital. อินดิเคเตอร์

Footprint Delta Auction Map [BullByte]Footprint Delta Auction Map is an Auction-Market-Theory analytical framework that measures directional pressure through a 3-Tier Delta Engine (TradingView native volume footprint, lower-timeframe intrabar reconstruction, and single-bar OHLCV proxy), qualifies it against candle conviction and multi-source level confluence (POC, VAH, VAL, session H/L, prior day H/L, weekly H/L, round numbers), classifies the current session as a Trend, Balance or Neutral Day using an Initial Balance regime detector, and only then marks a directional scenario on the chart with a fully sized reference-level map (Entry, Reaction, Extension, Invalidation).
It is designed for discretionary traders who want a single, transparent framework that brings order flow, price structure, key reference levels and session regime into one auditable qualification process.
---
1. WHAT THIS SCRIPT IS
On each confirmed bar with the required data available, the framework evaluates four complementary questions before a directional scenario can qualify:
Q1 - Is there directional pressure right now?
Measured through a 3-tier delta engine (see Section 4). Normalized to a bounded -100 to +100 Unified Auction Pressure reading.
Q2 - Is the candle itself convincing?
Measured through body-to-range ratio and range-to-ATR ratio. A high pressure reading on a doji inside a compressed range does not qualify.
Q3 - Is this happening at a location the market has already respected?
Measured through a weighted Confluence Ladder that scores proximity to POC, VAH, VAL, session high/low, prior day high/low, weekly high/low, and configurable round numbers.
Q4 - What is today's session character?
Measured through an Initial Balance (IB) day-type classifier (Trend / Balance / Neutral Day) that adjusts the qualification threshold and Extension sizing.
Only when all four align, a higher-timeframe EMA trend agrees, and the current session's IB is fully formed does the script mark a directional scenario and draw a full reference-level map on the chart.
---
2. WHAT PROBLEM IT SOLVES
The framework is designed to bring several normally separate forms of market context into one qualification process.
This script is built on the design premise that directional pressure, candle structure, location and session context each answer a different question about the same market event. Rather than treating any one measurement as a standalone trigger, the framework requires these conditions to agree before it marks a directional scenario. The intent is to provide more context around each signal and make the qualification process auditable, not to claim any specific rate of success.
Concretely, it helps with:
- Deliberate selectivity. A three-criterion gate (Pressure, Candle, Confluence) plus a composite score threshold plus HTF alignment plus IB regime plus cooldown means signals are intentionally infrequent and situational.
- Instrument-adaptive sizing. For sizing purposes, the script automatically derives an instrument-specific volatility band from the symbol's own historical ATR-as-percent-of-price distribution, reducing the need to manually retune the basic Sizing Unit for each market.
- Full transparency. A dashboard and a debug panel show which data tier is active, what the composite score is, which qualification criteria passed, what the session regime is, and where the current scenario stands.
- Session-aware context. An Initial Balance day-type verdict (Trend / Balance / Neutral) recalibrates how demanding the signal threshold is and how far Extension targets project.
---
3. HOW THE FRAMEWORK WORKS
Each layer answers a specific question from auction market theory, and the layers are structured in dependency order:
Delta / Auction Pressure - describes what the directional pressure reading says about the current auction. Sourced from TradingView's native volume footprint when available (Tier 3), from lower-timeframe intrabar reconstruction when not (Tier 2), or from a single-bar OHLCV pressure proxy as a universal fallback (Tier 1). Each tier is normalized independently to a common bounded -100 to +100 scale.
Candle Conviction - did the bar actually travel and close with intent. Prevents a strong pressure reading on a wick-heavy doji from qualifying.
Level Confluence - is this happening at a price the market has already marked as significant. Uses a triangular decay proximity kernel across POC, VAH/VAL, session H/L, prior day H/L, weekly H/L and round numbers, with pre-defined relative weights. When native footprint data is active, the true volume-profile references receive the highest weights; when footprint data is unavailable, their proxy weights are reduced so the ladder does not treat session-derived references as genuine volume-profile levels.
IB Regime Classifier - what kind of day is this. Compares today's Initial Balance range against a rolling historical median of prior sessions (today's IB is never included in its own median). Wider than median → Trend Day (raise threshold, widen Extension). Narrower than median → Balance Day (lower threshold, compress Extension). Otherwise Neutral.
HTF EMA Filter - does the larger timeframe agree with the direction. Uses confirmed previous higher-timeframe EMA slope only (non-repainting pattern with barmerge.lookahead_on on a offset).
Each contributes information the others cannot. Removing any one of them changes what the signal means , not just how many signals fire. That dependency structure is what distinguishes this framework from an aggregation of unrelated indicators.
This is not a mashup of separate published indicators or unrelated indicator modules combined for convenience; it is a single framework in which each measurement was selected and integrated for a specific role in the qualification process.
---
4. THE THREE DATA TIERS
The three-tier architecture allows the script to use native footprint data when available and progressively simpler pressure estimates when it is not. The active tier is always shown on the dashboard so the user knows exactly what data is currently feeding the score.
Tier 3 - Native TradingView Footprint (requires Premium or Ultimate plan and footprint-supported symbol)
Uses request.footprint() . TradingView categorizes lower-timeframe volume via intrabar price action to produce buy volume, sell volume and delta. This is the only tier in this script that uses native footprint data. Not raw exchange bid/ask tick data.
Tier 2 - Intrabar Reconstruction (default, no special plan required)
Uses request.security_lower_tf() to decompose each bar into its lower-timeframe sub-bars, then applies the close-in-range volume heuristic to each sub-bar before summing. A lower-timeframe refinement of the single-bar OHLCV pressure estimate that can better distinguish intrabar two-sided movement than a single-OHLC read alone. This is an auction pressure estimate, not native footprint data.
Tier 1 - OHLCV Proxy (universal fallback)
buyPressure = (close − low) / range × volume
sellPressure = (high − close) / range × volume
A single-bar pressure proxy. Used when native footprint data is not active and lower-timeframe reconstruction is unavailable, disabled, or returns no usable intrabar data. Coarsest estimate.
All three tiers are normalized onto a common bounded -100 to +100 scale before entering the composite score. Same scale does not mean identical statistical distribution: Tier 3 footprint delta and Tier 1 OHLCV pressure have different underlying measurement characteristics. The normalization ensures the score is internally self-consistent per tier.
---
5. COMPOSITE SCORE AND QUALIFICATION
When the required calculation data is available, the framework produces a Composite Score between 0 and 100:
Composite Score = Fingerprint Score × 0.60 + Ladder Score × 0.40
Fingerprint Score (60% weight) combines three sub-components on the current bar:
- Auction Pressure conviction - up to 40 points, based on absolute normalized pressure
- Candle body and range structure - up to 35 points (20 points body ratio, 15 points range-to-ATR ratio)
- Volume/pressure balance magnitude - up to 25 points, using the active tier's available pressure representation
Ladder Score (40% weight) provides location context. Each active reference level is scored using a triangular proximity kernel: score = 1 − (distance / tolerance) when distance is within tolerance; otherwise the score is zero. Levels are then weighted using predefined relative weights. When native footprint data is active, the genuine volume-profile references receive the highest weights; when footprint data is unavailable, those reference weights are reduced because the script uses session-derived proxies rather than true volume-profile levels.
The 60/40 weighting reflects the design choice to give greater influence to pressure, candle structure and volume/pressure balance than to location. Location confirms; pressure and structure trigger.
Signal qualification requires all of the following simultaneously:
- Composite Score at or above the effective threshold (default 58, adjusted ±5 by IB day-type)
- Auction Pressure absolute value at or above Criterion 1 minimum (default 35)
- Candle body ratio at or above Criterion 2 minimum (default 0.50)
- Number of level-confluence hits at or above Criterion 3 minimum (default 2)
- HTF EMA slope aligned with signal direction (if HTF filter is enabled)
- Current session's Initial Balance is fully formed and historical IB sample exists
- Current bar's direction (close vs open) aligns with pressure direction
- No active scenario, and cooldown not in effect
---
6. IB REGIME AND HTF CONTEXT
Initial Balance regime detector. The first N bars of each session define today's IB range. That range is compared to the rolling median of prior sessions' IB ranges (today is never included in its own median). If today's IB is 1.25x or wider than the historical median, the classifier labels the session Trend Day, raises the qualification threshold by 5 points, and sets the IB Extension scalar to 1.15x. If today's IB is 0.75x or narrower, it labels Balance Day, lowers the qualification threshold by 5 points, and sets the IB Extension scalar to 0.85x. Otherwise, the session is classified as Neutral Day. The final Extension multiplier is also affected by the volatility scalar and the minimum effective-multiplier floor described in Section 7. This is a heuristic regime signal, not a factual market classification.
The IB layer adjusts only the qualification threshold and the Extension multiplier. It does not change the 60/40 composite weights. Signals are also suppressed until the current session's IB has formed and at least three completed historical IB samples exist.
HTF EMA trend filter. The higher-timeframe EMA slope is evaluated on the confirmed previous HTF bar ( offset with barmerge.lookahead_on ), which is the documented non-repainting pattern for confirmed HTF references. The HTF resolution is validated to be strictly higher than the chart timeframe before the request is made; if not, the script halts with an explicit error rather than silently misbehaving.
---
7. ENTRY / REACTION / EXTENSION / INVALIDATION
When a scenario qualifies, four reference levels are placed on the chart, all sized as multiples of a shared Sizing Unit (not raw ATR).
The Sizing Unit is a percentile-bounded percentage of price. Its min–max band is, by default, auto-derived from this instrument's own historical ATR-as-percent-of-price distribution (10th and 90th percentiles). This means the sizing base scales naturally with the instrument's own volatility character.
Then:
- Entry = signal bar close
- Reaction = Entry ± k1 × Sizing Unit (default k1 = 1.5)
- Extension = Entry ± effective k2 × Sizing Unit, where effective k2 is the larger of (k1 + 0.5) and (k2 base × IB scalar × volatility regime scalar) when Dynamic Extension Sizing is enabled. When dynamic sizing is disabled, the effective multiplier is the larger of (k1 + 0.5) and k2 base (default k2 base = 2.5)
- Invalidation = Entry ± k3 × Sizing Unit (default k3 = 1.5)
Extension scaling combines two factors:
- IB scalar: 1.15x on Trend Day, 0.85x on Balance Day, 1.00x on Neutral Day
- Volatility regime scalar: current ATR divided by baseline ATR, clamped between 0.8x and 1.6x so a single volatility spike cannot produce a runaway Extension
Same-bar resolution disclosure: When a single bar touches both Extension and Invalidation, OHLC data alone cannot establish which was reached first. The script uses a deterministic proximity convention (the level closer to the prior bar's close is assumed to have been reached first). This is a documented convention, not an observation of intrabar order.
---
8. DASHBOARD AND CHART INTERPRETATION
Directional badge on the signal bar
- Bullish-direction badge for LONG scenarios and Bearish-direction badge for SHORT scenarios; the default colors are green and red and are user-configurable.
- Header line: ▲ LONG or ▼ SHORT
- Second line: "FP Delta N" when Tier 3 is active, "Pressure N" when Tier 1 or Tier 2 is active. N is the absolute normalized Auction Pressure reading (0–100), not a percentage of volume.
- Third line: "near " - the highest-weighted level in proximity
- Fourth line: Session character (Trend Day / Balance Day / Neutral Day)
Four horizontal reference lines
- Entry (neutral color, adaptive to chart theme)
- Reaction (orange)
- Extension (purple)
- Invalidation (red)
Right-edge price tags - each of the four levels has a floating tag on the right edge of the chart showing its exact price. Tags are automatically separated vertically to reduce overlap among the four reference-level labels.
Reference level plots
- Prior Day High / Low (orange) - shown in the recent-bars segment
- Weekly High / Low (blue) - shown in the recent-bars segment
- IB High / Low (yellow, dashed)
- Session Reference (purple, dotted) - represents the footprint POC when Tier 3 is active and a session-derived reference when using Tier 1/2
Scenario lifecycle
- Pending - scenario is live; right-edge tags follow the current bar
- Reaction Zone Reached - an alert fires on the first qualifying post-signal touch of the Reaction level; Reaction does not end the scenario.
- Resolved-Extension - Extension reached first; scenario ends, right-edge tags removed, historical lines frozen
- Resolved-Invalidation - Invalidation reached first; same treatment
Main Dashboard (default: Top Right)
- Data Engine - Footprint (Tick), Intrabar (LTF Recon.), or Proxy (Single-Bar)
- Session Character - Trend Day, Balance Day, or Neutral Day
- Composite Score - current bar's score out of 100
- Score Requirement - effective threshold after IB adjustment
- Qualification Criteria - pass/fail status for Pressure, Candle, and Confluence
- Active Scenario - "None" if flat, or "Long/Short - Active (awaiting resolution)" if in progress
- Cooldown - visible only when active
- Reference Sizing (Inv : Ext) - the ratio currently applied
Debug Dashboard (default: Bottom Right, can be turned off)
- Fingerprint Score (60% wt.)
- Ladder Score (40% wt.) - score plus number of levels in proximity
- Nearest Level - the highest-weighted level currently in proximity
- Footprint Delta / Auction Pressure - the normalized -100 to +100 reading, labeled by active tier
- Extension Sizing Factor - the current volatility scalar and IB scalar
- Active Data Tier - full name of the tier plus (for Tier 2) number of intrabars in the current reconstruction
---
9. ILLUSTRATIVE SIGNAL WALKTHROUGH
The following description is illustrative and is included only to demonstrate how the scoring workflow is interpreted. It is not a historical performance result and does not represent past or future outcomes.
Consider a 15-minute chart of a liquid instrument during a session that has been classified as a Trend Day.
Setup context:
- Session Character: Trend Day (today's IB is wider than the historical median)
- Effective Score Requirement: raised by the IB adjustment
- HTF (1H) EMA slope: rising
- Data Engine: Intrabar (LTF Recon.) - user is on a plan without native footprint access
Bar N (signal bar):
- Bar closes with a strong upward body (body/range ratio comfortably above the 0.50 minimum)
- Intrabar reconstruction shows aggregated buy-side pressure over sell-side, producing a Unified Auction Pressure reading well above the Pressure minimum
- Price is trading close to the Prior Day High and near a Round Number, both within Level Tolerance
- Ladder Score registers multiple levels in proximity
- The Composite Score exceeds the effective Trend-Day threshold; Pressure, Candle and Confluence criteria all pass; HTF direction agrees; session is ready
- Signal qualifies. A bullish-direction LONG badge appears with text similar to:
- ▲ LONG
- Pressure (value)
- near Prior Day High
- Trend Day
Level map plotted from the Entry close:
- Entry = close of bar N
- Reaction = Entry + k1 × Sizing Unit (orange)
- Extension = Entry + effective k2 × Sizing Unit, scaled by Trend-Day and volatility factors (purple)
- Invalidation = Entry − k3 × Sizing Unit (red)
- Dashboard "Active Scenario" changes to: Long - Active (awaiting resolution)
Subsequent bars: As price advances into the Reaction Zone, an alert fires ("Reaction Zone reached"). The scenario stays active - Reaction is a first-touch alert, not a resolution. If price then reaches the Extension level, the scenario resolves as Resolved-Extension: right-edge tags are removed, the four reference lines freeze at the resolution bar, the "Active Scenario" cell returns to "None", and a cooldown period begins during which no new signals can fire. If instead price reached the Invalidation level first, the scenario would resolve as Resolved-Invalidation with the same freeze and cooldown behavior. In the rare case where a single bar touches both Extension and Invalidation, the proximity-based tie-breaking convention (Section 7) determines the resolved outcome.
Note on FVGs and Order Blocks: This script does not natively detect Fair Value Gaps or Order Blocks. Traders who use dedicated FVG/OB analysis can treat those structures as external chart context and compare them with the reference-level map produced by this script. For example, a trader may observe a signal near a Prior Day Low or VAL while independently identifying a bullish Order Block or FVG at the same area. The FVG/OB structure is not generated or validated by this script.
Real Chart Example with explanation
Example 1: A short scenario was marked on Gold when Tier‑2 intrabar-reconstructed Auction Pressure hit 98 on a bearish, high-conviction candle sitting inside confluence tolerance of the Prior Day Low pushing the Composite Score above the 58 threshold under a Neutral Day regime. Footprint (Tier 3) was OFF for this example, so the pressure reading came from OHLCV-based intrabar reconstruction, not native footprint delta. Entry locked at that bar's close (4,363.94); price stalled near PDL for ~30 minutes, then broke down through the Reaction level (4,357.72) and into the Extension zone (4,355.12), with the current bar's intrabar low (4,352.76) already trading beyond Extension, though the scenario still shows "Active" since resolution only confirms on bar close.
Example 2: A long scenario was marked on QQQ when native Footprint (Tier 3) delta hit +66 on a bullish candle confluent with POC, under a Balance Day regime that lowered the qualification threshold by 5 (58 → 53) because today's Initial Balance was narrower than the historical median. Entry locked at 729.35; price consolidated near Entry for roughly an hour, then broke out through Reaction (730.25) toward Extension (730.55), with the Balance Day IB scalar (0.85x) compressing the Extension distance compared to a Trend Day setup. Unlike the earlier Gold example, this signal used genuine tick-based footprint data rather than OHLCV reconstruction.
---
10. SETTINGS
Recommended usage:
Designed primarily for intraday analysis on 5m, 15m, 30m and 1H charts, with the exact usefulness depending on the instrument's session structure and liquidity. Works on liquid crypto pairs, index futures and CFDs, liquid FX pairs, and large-cap equities during regular session hours.
Timeframe defaults:
- On 5m–15m charts : default HTF = 60 (1H), Intrabar Reconstruction = 1m
- On 30m–1H charts : consider raising HTF to 240 (4H)
- On 1m charts: leaving Intrabar Reconstruction at the default "1" causes the lower-timeframe request to fall back to Tier 1 because the requested resolution is not lower than the chart timeframe.
- Do not set Intrabar Reconstruction to a seconds-based resolution on 5m or higher charts - this can exceed TradingView's intrabar request cap
Not recommended for very illiquid instruments, daily or higher timeframes (IB is intraday by design), or symbols with no volume data.
Settings you may want to change frequently:
- Composite Score Requirement (default 58) - raise for more selective signals, lower for more frequent
- HTF Resolution (default 60) - align with your own top-down analysis
- Cooldown Period (default 20 bars) - longer for swing style, shorter for scalping
Settings you may want to tune per market:
- Round Number Step - choose a positive price interval appropriate to the instrument
- IB Window (bars from session open) - on a 15-minute chart, the default 6-bar IB window represents 90 minutes; adjust to match the session structure you want to analyze
These settings are intended as general-purpose defaults and usually do not need frequent adjustment:
- All ATR-related inputs (Length, Outlier Filter, Floor)
- Pressure Normalization Lookback
- Sizing Regime Lookback
- Auto Sizing Band Lookback
- Level Tolerance % - controls how close price must be to a reference level for that level to contribute to confluence; the default is 1.2%; users may adjust it to suit the instrument and timeframe
Advanced toggles:
- Enable Footprint Engine (Tier 3) - leave OFF unless you have Premium/Ultimate and your symbol supports footprint data
- Enable Intrabar Reconstruction (Tier 2) - leave ON by default; with the default 1-minute resolution it falls back to Tier 1 on a 1-minute chart because the requested timeframe is not lower than the chart timeframe
- Use Dynamic Extension Sizing - leave ON for auto-scaled Extension by IB and volatility regime
- Auto-Derive Sizing Band - leave ON to get instrument-appropriate SL/TP sizing automatically
- Require Next-Bar Confirmation - turn ON for fewer, more selective signals at the cost of one bar of lag
---
11. ALERTS
Five alert conditions are available in the TradingView alert dialog:
- FDAM - Long Scenario Marked
- FDAM - Short Scenario Marked
- FDAM - Reaction Zone Reached
- FDAM - Extension Zone Reached
- FDAM - Invalidation Level Reached
The script also uses alert() calls for dynamic messages. Those programmatic alerts are issued once per confirmed bar close. The alertcondition() entries are selectable in the TradingView alert dialog; the script raises those conditions only on confirmed bars, while the selected alert frequency is configured in TradingView.
The dynamic alert() messages for Long and Short scenarios include the direction, active-tier pressure reading, nearest qualifying level, and session character (for example: "▲ LONG - Pressure 64 near Prior Day High (Trend Day)").
---
12. LIMITATIONS
- This is a discretionary analytical indicator rather than a built-in strategy backtest. It does not calculate audited P&L, win rate or historical strategy performance.
- The 3-tier delta engine is not equally precise across tiers. Tier 3 uses native TradingView footprint data. Tier 2 uses lower-timeframe OHLCV reconstruction. Tier 1 uses a single-bar OHLCV proxy. Each is normalized to the same -100 to +100 scale, but same scale does not mean same statistical distribution. The dashboard always shows which tier is active.
- The IB day-type classifier is a heuristic, not a factual market classification. "Session" is defined by whatever session context the chart symbol reports via session.isfirstbar - this varies across equities, futures, crypto and FX. The classifier labels a session based on IB-to-historical-median ratio thresholds; it does not identify participant intent.
- The confluence ladder weights are pre-defined analytical weights, not statistically derived reliability scores. They reflect the relative significance of level types in auction market theory as designed by the author.
- Same-bar Extension/Invalidation resolution uses a deterministic proximity convention based on distance from the prior bar's close. OHLC data alone cannot establish actual intrabar sequence. This is disclosed on-chart via the resolution status and in this description.
- Signals are intentionally suppressed until the current IB is formed and at least three completed historical IB samples are available.
- Footprint mode (Tier 3) may behave inconsistently during Bar Replay because of TradingView's footprint data caching. The script displays an on-chart notice when Footprint mode is enabled and recommends disabling it for replay testing.
---
13. DISCLAIMER
This script is a technical analysis tool built for educational and informational purposes only. It does not constitute financial advice, investment advice, trading advice, or a recommendation to buy or sell any security or instrument. Nothing produced by this script - signals, scores, zones, or labels - should be interpreted as a guarantee of future price behavior. Markets are probabilistic, not deterministic; past patterns in auction structure, delta, or volatility regime do not guarantee repeat outcomes. Trading leveraged instruments (crypto, futures, indices) carries substantial risk of loss. You are solely responsible for your own trading decisions, position sizing, and risk management. The author assumes no liability for losses incurred through the use of this script.
Users on plans that do not support volume-footprint data should leave the Footprint Engine toggle OFF. With Footprint mode disabled, the script uses Tier 2 when a usable lower-timeframe reconstruction is available and Tier 1 otherwise.
Published as open-source under the Mozilla Public License 2.0.
- BullByte อินดิเคเตอร์

อินดิเคเตอร์

อินดิเคเตอร์

CPI Gate Regime v3.1 (SMA)CPI Gate Regime v3.1 (SMA)
A daily trend + macro-regime dashboard built for trading TQQQ, using QQQ as the regime instrument. The trend signal runs on the TQQQ chart you apply it to; the bear-market classifier deliberately measures the underlying index (QQQ), because the index defines the market regime while the leveraged ETF is only the vehicle.
What chart to use it on
Apply it to the TQQQ daily chart (or another QQQ-tracking vehicle you trade). The moving-average signal computes on the chart symbol — on TQQQ, the lines are TQQQ's own 200-day and 20-day SMAs. The bear latch, however, always reads QQQ's drawdown, regardless of chart symbol. This is intentional: a −15% drawdown in QQQ corresponds to roughly a −40% move in TQQQ, and measuring the regime on the noisier 3x series would latch it on ordinary corrections. Index for the regime, leveraged ETF for the trade.
The idea
Not all bear markets are the same shape. Fast crashes in low-inflation environments (2018, 2020) tend to V-bottom, and a fast re-entry catches the recovery early. Grinding bears in high-inflation environments (2000–02, 2022) chop down for months, and the same fast re-entry buys every failed rally. The differentiator used here: when CPI is above ~3%, the central bank is constrained (cutting into hot inflation is hard), so declines are more likely to grind. When CPI is below 3%, policy support is available and declines are more likely to snap back.
Trend signal (two-speed, on the chart symbol — TQQQ)
200-day and 20-day simple moving averages of the daily close, computed on daily bars regardless of chart timeframe. Lines plot green when the close is above them, red when below.
The rule: LONG when the close is above the 200-day SMA, or (below it) above the 20-day SMA; FLAT only below both. Above the 200-day the position is locked long and the 20-day is ignored — the fast line only becomes active below the 200, where it serves as the early re-entry during a recovery.
In a latched GRIND bear (see below), the 20-day re-entry is disabled entirely — only a full 200-day reclaim signals a buy.
Signals on the chart
Exactly two marker types, printed only when the complete system flips: a green BUY label below the bar, a red SELL label above it. No markers on ordinary 20-day crosses (they don't change the position above the 200-day), and no markers on 20-day re-entries during a grind bear (the system refuses those trades). What you see marked is what the rule set actually does. Signals form on the daily close; execution is assumed at the next open.
The latched bear regime (the "CPI gate", on QQQ)
A bear LATCHES when QQQ closes 15% or more below its trailing 2-year high.
At that moment — once — the classifier checks CPI YoY: above the gate (default 3%) = GRIND, below = SNAP.
Latched means latched: the mode does not flip-flop with daily data. One-way upgrade only: SNAP can become GRIND if CPI heats up mid-bear, never the reverse.
The latch releases when QQQ recovers to within 5% of its 2-year high.
Effect on signals: GRIND kills the fast re-entry (200-day reclaim only); SNAP keeps the normal two-speed.
Dashboard (early warnings, top right)
CPI YoY vs the gate (ECONOMICS:USIRYY)
FINRA margin debt YoY — manual input; elevated / blow-off thresholds
High-yield credit spread (FRED:BAMLH0A0HYM2) — waking / stress thresholds
QQQ drawdown from its 2-year peak — heads-up at −10%, trigger at −15%
Regime label escalates: CALM → FRAGILITY BUILDING (hot CPI + elevated margin) → STRESS IGNITING (credit spreads waking) → BEAR: SNAP or GRIND (latched)
Only the −15% / CPI latch changes the signals; the other rows are context so a latch never arrives as a surprise.
Inputs
All thresholds are configurable: SMA lengths, CPI gate %, margin elevated/blow-off %, HY spread waking/stress (bps), drawdown heads-up/trigger %, and the CPI / HY spread symbols. Margin debt YoY is entered manually (FINRA publishes monthly).
Notes
Designed on daily bars; on intraday charts the signal stays locked to daily data. The bear-latch state on historical bars is computed from the chart's loaded history, so labels at the far left edge of a short history may differ from a fully loaded chart; current-bar state is unaffected. For educational purposes — this is a regime framework, not financial advice. Test any rule set yourself before trading it.
v3.1 — markers now show only full-system BUY/SELL signals (including the grind-bear gate); removed the 20-day cross dots and 200-day flip triangles. อินดิเคเตอร์

The Essential Pivots
The Essential Pivots
Not every pivot deserves space on your chart.
The Essential Pivots was designed around a simple idea: emphasize the higher-importance pivot levels that tend to attract greater participation, receive more meaningful reactions, and produce larger directional moves—while removing many of the secondary levels that often add more clutter than clarity.
Traditional pivot indicators can fill the chart with numerous support and resistance lines. Although every calculated level may have a purpose, displaying all of them at once can make it difficult to recognize which areas truly matter. The Essential Pivots takes a more selective approach, giving traders a cleaner view of the market’s most significant reference points.
Why These Pivots Matter
Major pivots can act as areas where:
Price pauses, rejects, or reverses
Breakouts gain momentum
Previous resistance becomes support, or support becomes resistance
Buyers and sellers compete for directional control
Trend indicators react, flatten, or change direction
Larger intraday and multi-session moves begin
Because these levels represent broader reference points, they may be watched by more market participants than many lower-priority pivot levels. This does not mean price will always reverse at a pivot. Instead, the levels identify areas where trader attention and the probability of a meaningful reaction may increase.
A Cleaner Approach to Market Structure
The primary purpose of The Essential Pivots is not to predict every market turn. It is to simplify the chart so traders can quickly answer a more useful question:
Where are the most important decision areas right now?
By concentrating on essential pivot levels, the indicator helps reduce visual noise and prevents the chart from becoming a maze of competing horizontal lines. This makes it easier to combine the pivots with price action, market structure, volume, or a preferred trend indicator without overwhelming the screen.
Ways to Use the Indicator
The Essential Pivots can help traders evaluate:
Rejection entries when price tests a pivot and fails to continue
Breakout opportunities when price closes decisively through a level
Retests after a broken pivot changes its role
Profit targets near the next major pivot
Stop placement beyond a confirmed structural level
Consolidation when price repeatedly crosses the same pivot
Confluence with trendlines, moving averages, opening ranges, or volume-based tools
A pivot should generally be treated as an area of interest rather than an automatic entry signal. The quality of the reaction still matters. A decisive rejection, strong close, successful retest, or expansion in momentum provides more information than price merely touching the line.
Reading Price Around a Pivot
Rejection: Price tests the pivot but closes back away from it, suggesting the level is being defended.
Breakout: Price closes clearly beyond the pivot with directional conviction.
Retest: Price returns to the broken level and holds it from the opposite side.
Acceptance: Price repeatedly trades on both sides of the pivot, suggesting uncertainty or balance rather than a clean directional edge.
Role reversal: A former resistance level begins acting as support, or former support begins acting as resistance.
When price repeatedly moves above and below a pivot, conditions may be too indecisive for the level to provide a reliable directional bias. In these situations, patience may be more valuable than prediction.
Visual Design
The indicator uses a consistent visual hierarchy so the pivots remain easy to identify without competing with candles or other tools. Essential levels are displayed with greater prominence, while the overall presentation remains intentionally minimal.
The quarterly pivot is enabled by default because it can provide valuable higher-timeframe context and may remain relevant across many trading sessions.
Best Practices
The Essential Pivots is most effective when used as a framework for context—not as a standalone buy-or-sell system. Traders may improve selectivity by considering:
The strength and direction of the prevailing trend
The quality of the candle reaction at the pivot
Whether price is rejecting, breaking, or accepting the level
The distance to the next significant pivot
Current volatility and market conditions
Alignment with higher-timeframe structure
The strongest opportunities often occur when price reaches an important pivot with clear directional intent and then confirms whether the level is being defended or surrendered.
Final Perspective
The Essential Pivots is built for traders who want fewer lines and more meaningful information.
Rather than displaying every possible pivot calculation, it focuses attention on the levels most likely to influence price behavior, support larger moves, and provide useful structural context. The result is a cleaner chart, a clearer decision-making process, and more room to observe what matters most: how price actually responds when it reaches an important level.
Important: Pivot levels are reference points, not guarantees. This indicator does not provide financial advice and should be used alongside appropriate confirmation, risk management, and independent analysis.
อินดิเคเตอร์

PGO Ensemble [MiesOnCharts]An ensemble of Pretty Good Oscillators, one for every length in a range. Each one measures how far price sits from its own moving average, in units of its own average true range, and each holds a long or short state. The plotted score is the margin of the vote across them, running from -1 when every member is short to +1 when every member is long.
Built with daily bars in mind. The inputs adjust for other timeframes.
What PGO measures
Displacement from a moving average, divided by ATR over the same length. A reading of 2 means price sits two typical bars away from its own mean. Dividing by range is what makes it portable: the same number means the same thing on any symbol at any price.
Why an ensemble
Any single length is an arbitrary pick, and the best one is only obvious afterwards. Short lengths react fast and whipsaw. Long lengths are steady and late.
The reason this works on PGO in particular is the ATR division. Raw distance from a mean cannot be pooled across lengths, because a long average sits further from price by construction and would dominate any average of the two. Dividing by range over the same length puts every member in identical units, so a short member disagreeing with a long one is real information rather than an artefact of scale.
Members hold a state, not a reading
Each member latches long when it clears the upper threshold and stays long until it breaks the lower one. The vote counts positions rather than values, so a brief dip does not flip a member back.
The two thresholds are asymmetric on purpose. Price spends more time stretched above its mean than below in most markets, and a symmetric pair produces a permanent long bias.
A member that has never crossed either threshold contributes nothing. Early in a chart's history the score is muted for that reason, which is correct. Those members have no opinion yet.
Signals
Score at or above the trend threshold turns the state to uptrend and everything green. At or below the mirror of it, downtrend and red. In between, the previous state holds, so a brief loss of agreement does not end a regime.
Triangles mark each flip in the pane and on the price chart, the candles carry the regime colour, and both flips have alerts.
Inputs
Source and MA Type: the price series, and the average each member measures displacement from. VWMA falls back to the simple average on symbols that carry no volume.
Min Length, Max Length and Length Step: the range and spacing of the ensemble. A wider span mixes more timescales and gives a smoother score. Every member costs the same regardless of its length, so range is cheap here.
Long Threshold and Short Threshold: how far a member must be displaced before it latches.
Trend Threshold: how much of the ensemble must agree before the regime flips. Higher is more selective and later.
Flat When Split: whether an undecided ensemble holds the last regime or drops to flat.
Display toggles for the fill, the chart candles and the flip arrows.
How to use it
Read the colour as a regime filter rather than an entry.
Watch the score when it sits away from its extremes. A trend running with only half the ensemble behind it is resting on the short members alone.
Displacement is not direction. A member can be latched long while price falls, because it is still stretched above its mean.
Limits
It is reactive. It describes displacement that has already happened and will lag turns.
Nearby lengths give similar answers, so a narrow range delivers less of the averaging benefit than a wide one.
Latching cuts both ways. It holds a member through noise, and it also holds it too long when a move genuinely ends.
The asymmetric thresholds assume the usual upward drift. On a market without one they should be evened out.
No setting is right everywhere. Test on your own market and timeframe.
Credits
The Pretty Good Oscillator is Mark Johnson's. The TradingView implementation is Alex Orekhov's (everget). This script was inspired by QuantLapse's PGO variant, which is where the latching state and the asymmetric thresholds come from. The ensemble, the vote across it and the reconstruction of the members are the additions here.
Disclaimer
This indicator is provided for educational and informational purposes only and does not constitute financial, investment, or trading advice, nor a recommendation to buy or sell any asset. อินดิเคเตอร์

MSnR Classic StoryLine MTFMSnR Classic StoryLine MTF
A dashboard that reads the trend of five higher timeframes at once, and reports each one as
Bullish or Bearish.
What makes each reading is not an indicator applied to five timeframes. It is a two timeframe
process. The higher timeframe decides WHERE to look: it finds the support or resistance level
that price has just rejected. The lower timeframe then decides WHICH WAY: it waits for price to
break the last structural level standing in the way. Only when both halves complete does that
row change.
Nothing is calculated from the chart you are on, so the table reads the same on every timeframe.
You can sit on M5 and still read the Monthly trend.
THE FIVE PAIRS
Monthly decided on Daily
Weekly decided on H4
Daily decided on H1
H4 decided on M30
H1 decided on M15
Each row is completely independent. They share no state and can disagree with each other, which
is the point: agreement across rows is information, and so is conflict.
WHAT MAKES THIS DIFFERENT
1. Two timeframes decide one reading.
Most multi timeframe tools run the same calculation on several timeframes and stack the results.
Here the two timeframes have different jobs. The higher one supplies the context and never
decides direction on its own. The lower one supplies the proof and is never consulted without a
context. Neither half means anything alone.
2. Levels are tracked, not drawn.
A level is not a line that is placed once and left there. Every level created inside the window
is followed forward, candle by candle, and its state is updated: it can be rejected, it can be
broken, it can flip sides and come back to life. A rejection only counts when it happens on a
level that is still Fresh. This is what stops the same tired level from producing a signal over
and over.
3. Several setups wait at the same time.
Every rejection opens its own setup, and a newer one never cancels an older one. Two, five, a
dozen can be waiting together, each with its own level and its own breakout target. Whichever
one breaks out FIRST is the one that turns the trend. A tool that tracks only the latest
rejection is late whenever the older one was closer to completing.
4. Both directions are always watched.
A single higher timeframe candle can reject a resistance and a support at the same time. Both
open a setup. The one that completes first turns the trend, and the other stays alive and can
turn it back afterwards. Nothing is switched off because of what the trend already says.
5. It shows its own reasoning.
The dashboard alone would be a black box. So for one row of your choosing the script draws the
whole chain on the chart: the level that was rejected, the candle that rejected it, the lower
timeframe candle that touched it, the level that was locked, and the candle that broke it. You
can check every reading against the candles yourself.
THE LEVELS
Every pair of consecutive candles leaves a level behind, priced at the CLOSE of the first candle
of the pair. Closes are used rather than wicks because a close is where the market actually
agreed on a price.
A candle is Green when close is greater than open and Red when close is less than open. A Doji,
where close equals open, is neither and forms no level.
A Level Green then Red sits above as resistance
V Level Red then Green sits below as support
Bullish Gap Green then Green sits below as support
Bearish Gap Red then Red sits above as resistance
From there each level lives on one of two sides, and every close through it flips it:
RBS Resistance Become Support a resistance a candle CLOSED above
SBR Support Become Resistance a support a candle CLOSED below
A level can flip any number of times. Each flip also makes it Fresh again, because in its new
role it has never been tested.
Fresh and Unfresh
Fresh newly created, or just flipped. Untested on the side it now sits on.
Unfresh price has already come back, touched it, and been turned away.
Only a Fresh level can produce a rejection. Once it turns Unfresh it stays quiet until a
breakout flips it and makes it Fresh again.
HOW ONE ROW DECIDES ITS TREND
Step 1 - the higher timeframe rejection
A higher timeframe candle reaches a Fresh level and fails to close through it.
Support side the LOW touches the level and the CLOSE stays above it
Resistance side the HIGH touches the level and the CLOSE stays below it
The level turns Unfresh, and that is the event the row acts on.
A close THROUGH the level is not a rejection. It is a breakout, it flips the level, and it
produces nothing. Breakout is always checked before rejection.
If one candle rejects several Fresh levels at once, the LOWEST is taken on the support side and
the HIGHEST on the resistance side - the level price actually reached.
Step 2 - the reference line
The rejection candle's OPEN becomes the reference point. On the lower timeframe this lands on
the candle that opens at the same moment, and that candle is the first one examined. Nothing to
the left of it is ever looked at again.
Step 3 - the touch candle
Moving forward from the reference point, the first lower timeframe candle that reaches the
rejected level is the touch candle. Reaching it is enough; it does not matter whether price
bounces or cuts through.
The touch candle splits the chart in two: everything left of it is External, everything right of
it is Internal.
Step 4 - lock the level to be broken
On the External side, take the nearest level of the opposite kind:
Buy side context the nearest A Level to the left, for an upward break
Sell side context the nearest V Level to the left, for a downward break
It does not need to be Fresh. Any A or V will do. Only A and V are used here - Gap, RBS and SBR
are not.
Step 5 - the breakout
On the Internal side, wait for a lower timeframe candle to CLOSE through the locked level.
Close above the locked A Level the row turns Bullish
Close below the locked V Level the row turns Bearish
A wick through it is not enough, and the touch candle can never confirm itself - the earliest a
row can turn is the candle after the touch.
There is no time limit on the wait.
WHEN SEVERAL SETUPS ARE WAITING
Each open setup carries its own rejected level, its own reference line, its own touch candle and
its own locked level. They all run at the same time.
Setup A rejected 4050, waiting for a close below 4000
Setup B rejected 4040, waiting for a close below 4010
Price reaches 4010 first, so setup B turns the row Bearish. The instant that happens the row is
Bearish, and setup A never gets its turn.
A setup ends in one of three ways: it confirms, the higher timeframe closes through the level it
came from - which flips that level and makes the rejection meaningless - or it is pushed out by
the pending cap.
TREND PERSISTENCE
Once a row is Bullish it stays Bullish until a Bearish confirmation completes, and the other way
round. There is no sideways or neutral state in between, and no expiry.
Before the very first confirmation on a symbol a row reads No Trend. After that it is always one
or the other.
READING THE CHART
The dashboard
Five rows, each with a coloured dot, the timeframe name and its current trend. Hovering a row
name shows which lower timeframe confirms it. Rows can be hidden individually.
The setup visualiser
For the row you select, the chain that produced its current trend is drawn in the trend colour:
a horizontal line the higher timeframe level that was rejected, labelled with the timeframe,
the level type and its price, starting at the candle whose close created it.
a vertical line the higher timeframe rejection candle.
a vertical line the lower timeframe touch candle.
a horizontal line the locked A or V level, labelled with its timeframe and price.
a vertical line the lower timeframe candle that broke it.
If a setup is still waiting, it is drawn the same way in the opposite colour with dashed lines,
so you can see what the row is waiting for next. Everything can be switched off if you only want
the table.
SETTINGS
Dashboard Settings
- Table Position and Table Size.
Engine Settings
- Max Stored Levels (per HTF): how many levels each timeframe keeps in memory. Older ones are
forgotten, so a rejection from a very old level is only seen while it is still inside this
window.
- Max Pending Setups (per side): how many setups may wait at once. When full, the oldest is
dropped.
- History Depth (bars per timeframe): how far back each engine runs. Bars older than this are
skipped, because the levels they create would have been pushed out of the level window long
before reaching the present. Lower it if the script is slow on a heavy symbol.
Dashboard Rows
- An individual switch for each of the five rows.
Colors
- Bullish, Bearish and No Trend colours, used by both the table and the visualiser.
Setup Visualiser
- Show Active Setup On Chart, the row to draw, and whether to also draw the setup still waiting.
ALERTS
Ten alert conditions, one per row per direction:
Monthly Trend Bullish / Bearish, Weekly Trend Bullish / Bearish, Daily Trend Bullish / Bearish,
H4 Trend Bullish / Bearish, H1 Trend Bullish / Bearish.
Each fires only when a row actually FLIPS, not on every bar. Each message carries the row, the
direction, the symbol and the closing price. The same messages are sent through the alert
function, so the "Any alert() function call" alert type delivers every flip through one alert.
One thing worth knowing: an alert can only fire on a bar of the chart it was created on. If you
create it on a Weekly chart, a row that flips twice inside that week produces one alert, not two.
Create alerts on a chart timeframe at or below M15 and nothing is missed.
REPAINTING
The values do not repaint.
- Every engine reads confirmed candles only. It works on the previous, already closed candle of
its own timeframe, so the candle still forming can never enter the calculation and cannot
change what has already been decided.
- Each candle is processed exactly once. A timestamp guard makes a second pass over the same
candle impossible.
- No request uses lookahead, so no calculation can see data that had not happened yet.
- A row's value changes only when a candle of the timeframe that decides it closes. Once a row
has turned, that reading does not change afterwards.
- Because the calculation is independent of the chart, the table reads the same whichever
timeframe you are on.
When you create an alert, TradingView may show a caution banner saying the indicator can repaint.
That banner appears automatically for any script that requests data from other timeframes, no
matter how carefully it is done, because the platform cannot check the intent behind the request.
NOTES AND LIMITATIONS
- Intended for intraday charts, roughly M1 up to H4. On Daily and higher, the M15 and M30
requests have to cover a very long range and TradingView may refuse them with a memory
error on symbols with deep history. There is nothing to gain from a high chart timeframe
anyway, as the table reads the same everywhere.
- The far left of the chart reads No Trend. Each engine starts from a fixed depth, so it needs a
stretch of candles before the first confirmation completes. This never affects the current
reading.
- Levels older than the Max Stored Levels window are forgotten. A rejection from a very old
level will not be seen once it has aged out.
- Detection is purely structural. It reports which way a timeframe has turned and why. It does
not rank readings by quality, measure what happened afterwards, or produce entries, targets
or stops.
HOW TO USE IT
Read the rows as a stack. When the slow rows agree, the market has one direction and the faster
rows tend to give pullbacks inside it. When they disagree, the faster rows are usually working
against the slower ones, and that is normally where the choppy trading is.
The visualiser is there so you never have to take a reading on faith. Point it at the row you
care about and the whole chain is on the chart: which level was rejected, when, where price
touched it, and exactly which level had to break. If a reading looks wrong, the drawing shows you
why it is what it is.
These are structural readings, not entry signals. Use them as direction and context alongside
your own levels, your own entry method and proper risk management.
DISCLAIMER
This indicator is a market structure analysis tool. It is not financial advice and it makes no
claim about profitability. Trading involves risk. Always apply your own analysis and risk
management. อินดิเคเตอร์

Fibonacci Trend Continuation Signals [AlgoAlpha]🟠 OVERVIEW
Fibonacci Trend Continuation Signals maps Fibonacci retracement levels inside an adaptive trend structure. It combines a smoothed price midline, volatility-based outer bands, and Fibonacci ratios to show where price is trading within the current bullish or bearish trend range.
The trend changes only when price moves beyond a volatility-adjusted outer band. Once a direction is active, the script projects 0.236, 0.382, 0.500, 0.618, and 0.786 levels between the active outer band and the midline. This creates a moving Fibonacci framework that adjusts as price and volatility change.
Continuation signals appear when price closes back through an enabled Fibonacci level in the direction of the active trend. This lets traders use retracements within an established trend instead of treating each Fibonacci level as a fixed reversal point.
🟠 CONCEPTS
Trend Midline — An exponential moving average of closing price. It forms the central reference for the trend structure and the endpoint of the Fibonacci range.
Volatility Bands — Outer boundaries placed above and below the midline using a smoothed measure of the high-to-low price range. Price crossing an outer band changes the active trend direction.
Fibonacci Trend Range — The distance between the active outer band and the midline. In bullish trends, levels are measured upward from the lower band. In bearish trends, they are measured downward from the upper band.
Fibonacci Levels — The 0.236, 0.382, 0.500, 0.618, and 0.786 ratios divide the active trend range into retracement zones that move with the underlying trend structure.
Continuation Signal — A bullish signal occurs when price closes upward through an enabled Fibonacci level during a bullish trend. A bearish signal occurs when price closes downward through an enabled Fibonacci level during a bearish trend.
🟠 FEATURES
Adaptive Fibonacci Profile — Displays five configurable Fibonacci levels between the active volatility band and trend midline.
Trend Continuation Signals — Shows bullish and bearish markers when price closes through an enabled Fibonacci level in the direction of the active trend.
Current Level Labels — Shows the current price value of each enabled Fibonacci level at the latest bar.
Trend Change Markers — Marks the Fibonacci structure when a new bullish or bearish trend begins.
🟠 HOW TO USE
Identify the active trend structure — A bullish structure projects Fibonacci levels from the lower band toward the midline, while a bearish structure projects them from the upper band toward the midline.
Watch price during a retracement — Use the displayed Fibonacci zones to see how far price has moved through the active trend range.
Look for continuation signals — An upward triangle shows that price crossed above an enabled Fibonacci level during a bullish trend. A downward triangle shows the equivalent bearish close below a level.
Compare signals with price structure — Use nearby swing points, support, resistance, or your existing confirmation method before acting on a continuation signal.
Adjust Midline Length, Pivot Length, and Band Width to control how quickly the trend framework responds to price and how wide its outer boundaries are.
Enable or disable individual Fibonacci levels to keep only the retracement levels relevant to your method.
🟠 CONCLUSION
Fibonacci Trend Continuation Signals combines volatility-based trend detection with adaptive Fibonacci retracement levels and directional continuation signals. It gives traders a moving reference for measuring pullbacks and identifying closes that resume movement in the active trend direction. อินดิเคเตอร์

Multi-MA Trend Ribbon [MarkitTick]💡 A fully adaptive moving-average ribbon that lets you choose from 30 different smoothing algorithms — from classic SMA/EMA to advanced adaptive filters like Kalman, JMA, KAMA, and a custom volatility-responsive method called LLAMA — then builds a multi-line, gradient-colored trend ribbon out of that single chosen method across up to 8 progressively longer lengths. Layered on top is an optional multi-timeframe bias filter, an ADX strength gate, a volume confirmation gate, webhook-ready JSON alerts, and a live diagnostic dashboard.
✨ Originality and Utility
Most ribbon-style indicators on the platform hard-code a single averaging method (usually EMA or HMA) and stack a handful of fixed lengths on the chart. This script takes a different approach: it treats the "ribbon" as a generic container and the "moving average type" as a fully interchangeable engine, with 30 distinct algorithms available from a single dropdown, all built from first principles (not by calling a bundle of pre-packaged libraries). Because every ribbon line is generated by the same underlying function at different lengths, switching the MA Type instantly re-renders the entire ribbon in the new smoothing style, giving traders a single tool to compare how trend-following behaves under drastically different mathematical assumptions (linear vs. exponential weighting, adaptive vs. fixed responsiveness, zero-lag vs. standard lag) without switching indicators.
The script's originality centers on three custom-built components not found in standard built-ins:
A proprietary adaptive length mechanism ("LLAMA") that dynamically expands or contracts each ribbon line's effective lookback based on a short-term directional forecast, rather than using a static length.
A dual-RSI-divergence-weighted directional predictor that feeds that adaptive length engine.
A from-scratch implementation of less commonly available filters (Kalman, JMA, FRAMA, T3, McGinley, Super Smoother) that are not native Pine built-ins, giving traders access to algorithms usually reserved for institutional charting platforms or custom research code.
The mashup of a trend ribbon, a confluence filter stack (ADX + HTF + Volume), and a webhook alert system is justified because these three layers solve three different practical problems traders face together: identifying trend direction (ribbon), avoiding low-quality signals in choppy or thin conditions (filters), and automating execution (alerts) — components that are commonly used in sequence by discretionary and systematic traders alike, making their integration into one tool a genuine workflow simplification rather than an arbitrary bundling.
🔬 Methodology and Concepts
● Core Ribbon Construction
The script computes eight moving averages of the same source (default: close) at lengths that increase by a fixed step from a base length. For example, with a Base of 20 and a Step of 10, the eight lengths used are 20, 30, 40, 50, 60, 70, 80, and 90. The fastest line (MA1) and the slowest visible line (determined by the Lines setting) are compared: when the fast line sits above the slow line, the ribbon is considered to be in a bullish regime; when below, bearish. All eight lines are generated by the exact same averaging function, so the "shape" of the ribbon (how tightly or loosely the lines fan out) becomes a visual proxy for trend strength and consistency across time horizons.
● Selectable Smoothing Engine
The Type input lets you choose the mathematical method used to compute every single line in the ribbon simultaneously. The available families are:
Classic weighted averages: SMA, EMA, RMA (Wilder's smoothing), WMA, Triangular (TRIMA), Volume-Weighted (VWMA), and their double/triple-smoothed variants (DWMA/TWMA, DVWMA/TVWMA) which apply the same weighting function recursively to reduce lag-vs-noise trade-offs.
Zero/reduced-lag filters: Hull MA (HMA) and its extended variants EHMA and THMA, DEMA and TEMA (double/triple exponential smoothing, per Patrick Mulloy's original error-correction concept), and ZLEMA (zero-lag EMA using a momentum-shifted input).
Adaptive/volatility-responsive filters: KAMA (Kaufman's Adaptive MA, which speeds up or slows down based on an efficiency ratio of net movement to total movement), VIDYA (Chande's Variable Index Dynamic Average, which scales its responsiveness using Chande Momentum Oscillator readings), FRAMA (Ehlers' Fractal Adaptive MA, which estimates a fractal dimension from recent high/low ranges to adjust smoothing), and JMA (a Jurik-style adaptive filter using a two-stage predictive/corrective recursive structure).
Specialized/legacy filters: T3 (Tillson's six-pole exponential blend using a volume factor to control overshoot), McGinley Dynamic (a self-adjusting average that speeds up during fast markets and slows down during consolidation via a ratio-based denominator), ALMA (Arnaud Legoux MA, a Gaussian-weighted average with adjustable offset and smoothness), LSMA (least-squares linear regression endpoint), SWMA (a fixed symmetric 4-bar weighted average), Median, and SSF (a two-pole Super Smoother Filter using an Ehlers-style recursive IIR design).
Proprietary adaptive engine — LLAMA: A custom exponential filter whose smoothing constant is derived not from a fixed length, but from a dynamically computed effective length (see below).
• LLAMA and the Directional Predictor
LLAMA (the script's custom adaptive method) works in two stages. First, a directional forecast is built from two RSI readings (14-period and 28-period). Over a lookback window, each prior bar is scored by how closely its RSI signature matches the current bar's RSI signature (using a log-distance similarity weighting), and that similarity is used to weight whether price rose or fell on that historical bar. The weighted average of those historical outcomes produces a forecast value between -1 (strongly bearish precedent) and +1 (strongly bullish precedent). Second, that forecast value is used to stretch or compress each ribbon line's effective length within a configurable percentage range around its base length — a stronger bullish or bearish forecast pushes the effective length toward one end of the range, changing how reactive that specific line is to new price action. This effective length is then converted into a standard exponential smoothing constant to produce the final LLAMA value. The result is a moving average that behaves less like a fixed-parameter tool and more like a filter that continuously recalibrates its own sensitivity based on recent directional evidence.
● Trend Signals
Two categories of signals are generated:
Ribbon Flips: Triggered when the relationship between the fastest line and the slowest visible line changes state (fast crosses from below to above the slow line, or vice versa), using confirmed prior-bar values to avoid intrabar flicker.
Price Crosses: Triggered when price itself crosses the fastest ribbon line (MA1), independent of the broader ribbon state, offering an earlier but noisier entry cue.
● Confluence Filters
Three optional, independently toggleable filters can be layered onto both signal types to suppress low-quality triggers:
ADX Strength Filter: Requires Wilder's Average Directional Index (calculated via the standard DMI/ADX formula) to be above a minimum threshold before a signal is allowed to fire, filtering out signals generated during weak or range-bound conditions.
Higher-Timeframe Bias Filter: Recomputes the entire ribbon logic (fast MA vs. slow MA) on a user-selected higher timeframe and requires the current-timeframe signal to agree with that higher-timeframe bias before firing. This uses a confirmed prior-bar value pulled via request.security() with lookahead explicitly enabled on historical (already-closed) data only, so no future information leaks into the calculation.
Volume Confirmation Filter: Requires the prior bar's volume to exceed a multiple of its recent average volume, ensuring signals are backed by above-average participation rather than occurring on thin, low-conviction bars.
🎨 Visual Guide
Ribbon Lines (MA1–MA8): Up to eight plotted lines, one per configured length, colored on a gradient. When Trend Col is enabled, the gradient runs between your chosen Bull and Bear colors depending on the current trend state; when disabled, it instead runs between the Fast and Slow colors you've set, regardless of trend direction.
Ribbon Fill: The semi-transparent shaded area between each consecutive pair of ribbon lines, colored to match the current trend (bull or bear color) with adjustable transparency via the Fill Transparency setting. A tightly compressed, thin fill indicates the ribbon lines are converging (potential consolidation or transition); a wide, expanded fill indicates strong trend separation.
Bull/Bear Flip Markers: Small triangle shapes below or above the bars marking the exact bar where a confirmed Ribbon Flip occurred — an upward triangle in your Bull color for bullish flips, a downward triangle in your Bear color for bearish flips.
Heatmap Candles (optional): When enabled, replaces standard candle coloring with your chosen Bull/Bear body and border colors based on the ribbon's current trend state, turning the entire chart into an at-a-glance trend heatmap.
Dashboard Table: An on-chart panel (position configurable) summarizing, in real time: signal lock status, current bias, active MA type and lengths, a visual bar-graph readout of the number of active ribbon lines, the fast and slow MA values, the current spread between them, the LLAMA directional prediction strength, the most recent flip direction, the most recent price cross direction, how many filters are currently active, the live ADX reading, the +DI/-DI values, the current volume ratio versus average, and the higher-timeframe bias state.
📖 How to Use
Use the overall ribbon color and fill (bull color vs. bear color) as your primary trend read: a consistently bull-colored, moderately expanded ribbon suggests sustained upward momentum, while contraction or color-flipping suggests indecision.
Treat triangle Flip markers as your core trend-change signal — they only appear once the flip has been confirmed on a closed bar, and (if filters are enabled) only after passing your chosen strength, HTF-agreement, and volume conditions.
Treat Price Cross events (visible in the dashboard's "Price Cross" row) as a faster, more aggressive alternative entry cue for traders who want to react before a full ribbon flip occurs, understanding this comes with a higher likelihood of false signals.
Enable the Lock Signal option to freeze the current bias and temporarily suspend new signal generation — useful when you want to hold a view steady while manually reviewing a setup instead of reacting to every subsequent flip.
Watch the dashboard's Filters and individual ADX / Vol Ratio / HTF Bias rows to understand in real time why a signal is or is not being permitted to fire.
Consider combining a slower Type (e.g., RMA, T3, or a longer-length adaptive filter) for the overall bias with faster Price Cross signals for tactical entries within that bias.
⚙️ Inputs and Settings
Type: Selects which of the 30 supported averaging methods is used to build every line in the ribbon.
Src: The price source fed into all calculations (default: close).
Base / Step: Base sets the length of the fastest ribbon line; Step sets the length increment applied to each subsequent line. Together they define the full spread of lengths across the ribbon.
Shift: Applies a horizontal bar offset to all plotted ribbon lines. A non-zero value shifts the visual plot forward or backward relative to price and does not alter the underlying calculation.
Lines: Sets how many of the eight possible ribbon lines are displayed (2–8), which also determines which line is treated as the "slow" reference line for bias and flip calculations.
ALMA Off / ALMA Sig, T3 Vf, KAMA Fast / KAMA Slow, JMA Phase / JMA Pow, Kal Q / Kal R, LLAMA LB / LLAMA Rng: Method-specific tuning parameters that only take effect when the corresponding Type is selected — these control offset/smoothness for ALMA, volume factor for T3, the fast/slow efficiency bounds for KAMA, phase/power for JMA, process/measurement noise for Kalman, and lookback/range for the custom LLAMA engine.
ADX / HTF / Vol toggles and their sub-settings: Independently enable and configure the three confluence filters described in the Methodology section (strength threshold and length for ADX, target timeframe for HTF, lookback length and multiplier for Volume).
Lock Signal: Freezes the currently displayed bias and suppresses new flip/cross signals until disabled.
Trend Col / Fill / Fill Transparency / Width / Bars / Signals: Visual controls for whether ribbon coloring reflects trend state, whether the fill between lines is shown and how transparent it is, line thickness, whether heatmap candles are shown, and whether flip markers are plotted.
Dashboard Show / Position: Toggles the on-chart dashboard and sets its screen position.
Alert toggles and Action fields: Enable/disable Flip-based and Cross-based alerts independently, and customize the text string sent in each alert's JSON payload for long entry, short entry, close-long, close-short, cross-up, and cross-down events — designed to be dropped directly into webhook-based automation.
⚠️ Confirmation Lag Notice
The Shift input allows ribbon lines to be plotted with a backward or forward bar offset relative to the current price bar. When a non-zero Shift value is used, what you see plotted at a given bar's x-position does not represent that bar's actual calculated value in real time — always verify the Shift setting is at its default (0) if you intend to use the ribbon for real-time signal interpretation, and be aware that a non-zero offset can visually misrepresent how early or late a line's response to price actually was.
🔍 Deconstruction of the Underlying Scientific and Academic Framework
This script draws on several distinct threads of technical and quantitative theory:
Classical trend-following theory: The core "fast MA vs. slow MA" bias mechanism traces back to Dow Theory's premise that trend direction can be inferred by comparing price behavior across different time horizons — approximated here by comparing smoothed averages of different lengths rather than raw price.
Exponential smoothing and digital filter theory: Methods like EMA, DEMA, TEMA, and ZLEMA build on Patrick Mulloy's work on reducing the inherent lag of exponential moving averages through cascaded and momentum-adjusted smoothing, itself grounded in classical infinite impulse response (IIR) filter design from signal processing.
Adaptive filter theory: KAMA (Kaufman), VIDYA (Chande), and FRAMA (Ehlers) all apply the same broader principle from adaptive control theory — that a filter's time constant should not be fixed but should respond to a real-time measurement of market "efficiency" or "noise," whether measured via a directional efficiency ratio, momentum oscillator magnitude, or fractal dimension of price geometry.
State-space estimation theory: The Kalman filter option applies the classical Kalman filtering framework from control and estimation theory — treating the true underlying trend as a hidden state to be recursively estimated from noisy price observations, balancing a process-noise parameter (how much the true state is expected to drift) against a measurement-noise parameter (how much to trust each new observation).
Fractal market theory: FRAMA's dimension calculation is grounded in Mandelbrot's fractal geometry concepts as adapted by John Ehlers, using the scaling relationship between price range measured at different resolutions to infer whether the market is behaving more like a trending (lower fractal dimension) or random-walk (higher fractal dimension) process.
Directional Movement / trend strength theory: The ADX filter implements Welles Wilder's original Directional Movement System, which decomposes price movement into positive and negative directional components and derives a smoothed strength index from their divergence.
Weighted similarity / kernel-based forecasting: The custom LLAMA predictor's weighting scheme is conceptually related to kernel-weighted (locally weighted) regression and nearest-neighbor forecasting methods, in which historical observations are weighted by their similarity to current conditions (here, measured via RSI-signature distance) rather than treated with uniform recency weighting.
⚠️ Disclaimer
All provided scripts and indicators are strictly for educational exploration and must not be interpreted as financial advice or a recommendation to execute trades. We expressly disclaim all liability for any financial losses or damages that may result, directly or indirectly, from the reliance on or application of these tools. Market participation carries inherent risk where past performance never guarantees future returns, leaving all investment decisions and due diligence solely at your own discretion. อินดิเคเตอร์

Hull ALMAHull ALMA | MisinkoMaster
The Hull ALMA (HALMA) is a low-lag, hybrid moving average engineered to solve one of technical analysis's oldest trade-offs: lag versus smoothness. Classical moving averages like the SMA or EMA suffer from heavy lag during fast trend changes, while ultra-responsive averages like the standard Hull Moving Average (HMA) are notoriously prone to overshooting and producing sharp noise during sideways consolidation.
By replacing the weighted moving average core of the classic Hull algorithm with Arnaud Legoux Moving Averages (ALMA), the Hull ALMA eliminates lag through Gaussian-weighted smoothing rather than simple linear weighting. The result is a fluid, low-latency trend line that tracks price shifts rapidly while filtering out false breakouts and market noise.
How It Works (The Core Architecture)
The indicator combines the mathematical structure of the Hull transformation with Gaussian curve filtering:
Half-Length and Full-Length Gaussian Smoothing: The algorithm calculates two baseline ALMAs—one over half the lookback period (hln_halma) and one over the full lookback period (len_halma).
Lag Reduction Transformation: Following the classic Hull formulation, the full-period ALMA is subtracted from twice the half-period ALMA (2 * ALMA_half - ALMA_full) to project price direction forward and neutralize lag.
Square-Root Gaussian Smoothing: The projected series is smoothed a final time using an ALMA calculated over the square root of the lookback period (sln_halma), producing an ultra-smooth curve without introducing phase delay.
Dual-Confirmation Trend Filter: The algorithm concurrently tracks standard HMA slope alongside HALMA slope to ensure structural alignment before confirming regime shifts.
Key Features
Gaussian-Weighted Lag Elimination: Replaces linear weighting with ALMA's Gaussian curve distribution, providing superior smoothness and reduced overshoot.
Dual-Moving-Average Confluence: Evaluates both HALMA and HMA slope agreement to confirm high-probability trend direction.
On-Chart Candle Morphing: Automatically recolors main price candles (vibrant cyan for bullish trends, vivid red for bearish trends) to maintain clear visual alignment with active indicator state.
Multi-Line Overlay: Plots both the primary HALMA curve and the complementary HMA baseline directly on your price pane for easy visualization of moving average dynamics.
Input Parameters & Optimization Guide
Source: Sets the input price series used for calculations (Default: OHLC4).
HALMA Length: Sets the baseline lookback window. A default of 70 bars balances macro trend tracking with short-term responsiveness (Default: 70).
Offset: Controls the Gaussian distribution offset within the ALMA engine. Higher values increase responsiveness to recent price changes (Default: 0.85).
Sigma: Controls the width of the Gaussian filter. Higher values sharpen the smoothing focus, while lower values broaden the window (Default: 6).
Trading Strategies & Execution
Dual-Slope Regime Shifts
Bullish Alignment: Confirmed when both the HALMA and standard HMA are sloping upward, turning price chart candles cyan.
Bearish Alignment: Confirmed when both the HALMA and standard HMA are sloping downward, turning price chart candles red.
Dynamic Support & Resistance
In established trends, the HALMA line serves as dynamic trailing support during bull moves and dynamic resistance during bear moves. Look for pullbacks toward the HALMA curve for low-risk continuation entries in the direction of the active trend state.
Disclaimer: Trading financial markets involves high risk. This technical script is designed as an informational analytical tool to support your rule-based mechanical execution system and does not constitute financial advice. อินดิเคเตอร์

Setup Scanner [GBB]SETUP SCANNER
Most scanners tell you a setup fired and stop there. This one attaches a full trade plan to every signal: ATR stop, three R-multiple targets, an expiry and then tracks the outcome and keeps score per setup. New strategies can also be easily added to the scanner, so you do not have 20 different chart tabs open anymore at the same time.
How does it work?
On every confirmed bar the script evaluates six independent setups. Each one reports a state in the panel: off, dormant, forming, LONG or SHORT.
When a setup fires, a simulated trade opens at the close of the signal bar with:
- a stop at ATR(14) × 1.2 (configurable)
- TP1 / TP2 / TP3 at 1R / 2R / 3R
- an expiry after 60 bars
The trade is drawn as a risk box, a reward box, an entry line and a three-rung target ladder. As targets fill, their rungs promote from dashed to solid, so you can read how far a trade got at a glance. When it resolves, the whole drawing fades and gets an outcome tag: stop, TP3, or expired.
The panel counts, per setup, how many trades it opened and what share of them reached TP1.
Included Strategies in v1.0:
1. VWAP RECLAIM
Price must spend at least N consecutive closes (default 6) on one side of session VWAP, then close back across it. Volume filter applies. Forming state triggers when the run is mature and price is drifting back within 0.4 ATR of VWAP.
2. EMA PULLBACK (9/21)
Trend is defined by EMA21 vs EMA50 with EMA50 sloping in the same direction over three bars. Price must have touched EMA21 within the last N bars (default 3), then close back beyond EMA9 on a directional bar that takes out the previous bar's extreme. Volume filter applies.
3. BREAK AND RETEST
A confirmed swing pivot (length 5 either side) is broken on a close. Within the retest window (default 20 bars), price returns to within 0.3 ATR of the broken level and closes back beyond it on a directional bar. Pivots that form while a break is still live are queued rather than overwriting the level — the retest gets to finish before the reference moves. No volume filter.
4. LIQUIDITY SWEEP REVERSAL
A wick takes out the highest high or lowest low of the last 20 bars, the body closes back inside, and the rejection wick is larger than the opposite wick. Volume filter applies.
5. RSI DIVERGENCE
Consecutive confirmed pivots with a lower price low against a higher RSI low (or the inverse for shorts), within a maximum pivot gap of 60 bars. This confirms five bars after the pivot by construction. It is late, on purpose, and it has no forming state.
6. OPENING RANGE BREAK
The range is built from the session open for N minutes (default 15) in your chosen session and timezone, then the first close beyond either edge fires. One break per session, in either direction. The range levels plot once the range closes. For 24h crypto, set the timezone to UTC and pick your own anchor session.
TRADE COUNTING
Entry is the close of the signal bar. Risk is one ATR unit × the stop multiple, and the ladder is measured in multiples of that risk.
Exit accounting is deliberately conservative. If a bar touches both the stop and a target, the stop wins — intrabar sequence is unknowable from OHLC, so the outcome is on purpose counted as pessimistic. A trade that reaches TP1 or TP2 marks the rung and keeps running, only TP3 or the stop or the expiry closes it.
Three controls decide which signals become trades:
- Max concurrent trades (default 1)
- Block opposite-direction entries (default on)
- Re-entry cooldown in bars (default 0)
With the default of one concurrent trade, setups are evaluated in a fixed order — VWAP, EMA, break and retest, sweep, divergence, opening range — so when two fire on the same bar, the earlier one in that order takes the slot. Turn on "Mark blocked signals too" if you want to see the ones the limit swallowed.
The cooldown defaults to 0, which keeps every signal. That is why stops sometimes cluster back to back on an impulse bar. Raising it changes the record, so reset your counts when you change it.
READING THE SCOREBOARD — AND WHAT IT IS NOT
The "fired" column counts trades the engine actually opened, not raw setup fires. Signals blocked by the concurrency limit, the direction lock or the cooldown are not counted.
The "→TP1" column is trades that reached TP1 divided by trades fired. Reached, not captured: a trade that touches TP1 and later stops out still counts in the numerator. Read it as "how often does this setup get moving in my favour", not as a win rate and definitely not as an expectancy.
IMPORTANT
This is not a backtest. Counts accumulate forward over the bars loaded on your chart, they reset on every settings change and chart reload, and they include no commission, no spread, no slippage and no partial fills.
DEFAULTS AND TUNING
The defaults are not optimised. They are round numbers chosen to be readable and to avoid fitting a parameter set to whatever symbol happened to be on the chart during development. The ATR stop, the R ladder, the pivot length and the setup-specific windows are all exposed so you can adapt them to your instrument and timeframe, but every change invalidates the counts already on the panel.
If you tune, tune on one instrument at a time, and treat any improvement that does not survive on data you did not tune on as noise.
DISPLAY
- Trade zones can be turned off entirely if you only want the panel.
- Signal labels come in Full, Short, Arrow only, or Off.
- Closed trades fade by an adjustable amount; filled targets always fade less than unfilled ones, so a resolved trade still shows how far it ran.
- Keep last N drawings caps the chart clutter without affecting the counts.
- Panel position and text size are configurable; colours default to a dark-chart palette and should be dimmed for white backgrounds.
ALERTS
Every trade the engine opens fires an alert() call carrying the setup name, direction and price, once per bar close. Two alertcondition entries are also available for any long setup and any short setup. Note that those fire on the raw signal, whether or not the engine had room to take it.
LIMITATIONS
- Signals evaluate on confirmed bars only. Nothing is drawn or counted on an unclosed bar.
- Break and retest and divergence depend on pivots, which confirm five bars after the fact.
- The VWAP setup requires volume data and stays dormant on symbols that have none. The volume filter also passes automatically where volume is unavailable.
- The opening range setup depends on your session and timezone inputs being correct for the instrument.
- Designed for intraday timeframes. It will run on higher timeframes but the trade model and expiry are not calibrated for them.
อินดิเคเตอร์

MTF S&R Confluence DetectorMTF S&R Confluence Detector
OVERVIEW
MTF S&R Confluence Detector automatically maps support and resistance across three independently configurable timeframes, then highlights the spots where those levels stack on top of one another. Confluence — the alignment of multiple structural levels in the same price area — is one of the more reliable ways to identify zones where price is likely to react, and this script does the work of tracking it in real time instead of requiring you to flip between chart timeframes and eyeball it yourself.
Alongside the multi-timeframe pivots, the script also plots Previous Day High/Low and Today's High/Low, and checks those session levels for confluence with your MTF pivots — surfacing "high conviction" areas where intraday structure and prior-session structure line up.
Built and tested on Pine Script v6.
HOW IT WORKS
For each of the three timeframes, the script finds swing highs and swing lows using pivot detection (ta.pivothigh / ta.pivotlow) with independently adjustable lookback and lookahead periods. Each pivot is only confirmed once price has moved the required number of bars past it, so the levels you see are based on confirmed swing points, not predictions.
The most recently confirmed support and resistance level from each timeframe is held on the chart as a line until a new pivot forms and replaces it. A percentage-based "range" is drawn around each level (also configurable per timeframe) to represent a zone rather than a single exact price.
CONFLUENCE DETECTION
The script compares the current support level (and separately, the current resistance level) across all three timeframes. If two levels sit within your chosen confluence threshold (a percentage distance you control), they're flagged as confluent and both lines turn gold. If all three timeframes agree, that's flagged as a "triple confluence" — the strongest signal the script can produce. Confluent zones also get a soft gold fill so they stand out visually from ordinary single-timeframe levels.
The same confluence logic is applied to Previous Day High/Low against your MTF levels, so you can immediately see when a prior session extreme is reinforced by higher-timeframe structure.
KEY FEATURES
- Three independent, fully configurable timeframes for support/resistance detection (defaults: 1H, 4H, Daily)
- Adjustable pivot lookback/lookahead for support and resistance detection separately
- Per-timeframe color, and adjustable percentage "zone" width around each level
- Automatic confluence detection between any two timeframes, plus triple-confluence detection
- Adjustable confluence threshold (%) to control how close levels need to be to count as aligned
- Gold highlighting and zone fills on confluent levels so they stand out at a glance
- Previous Day High/Low and Today's High/Low overlays, each independently toggleable
- Increasing visual weight by timeframe — the highest timeframe is drawn thicker and dashed so higher-timeframe structure reads as more significant
- Clean price-scale labels identifying which timeframe each level belongs to
ALERTS
The indicator ships with a full set of ready-to-use alert conditions, including:
- Pairwise support/resistance confluence for every timeframe combination
- Triple confluence (all three timeframes aligned) for both support and resistance
- Price entering a confluent support or resistance zone
- Price breaking above Previous Day High or below Previous Day Low
- Price making a new session high or low
- Previous Day High/Low aligning with multi-timeframe resistance/support (high-conviction setups)
HOW TO USE IT
1. Set your three timeframes under the "Timeframe 1/2/3" input groups. By default these are 1H, 4H, and Daily, but you can set them to whatever combination fits your trading style (e.g., 15m/1H/4H for intraday, or 4H/D/W for swing trading).
2. Tune the pivot lookback/lookahead under "S&R Detection" to control how sensitive the swing detection is — shorter values find levels faster but produce more of them; longer values are more selective.
3. Adjust the "Confluence Threshold" to set how close levels from different timeframes need to be before they're treated as the same zone. Tighter for precision, wider to catch near-misses.
4. Toggle Previous Day High/Low and Today's High/Low on or off depending on whether you trade session-based levels.
5. Set alerts on any of the built-in alert conditions to get notified the moment a confluence zone forms or price reaches one.
NOTES
- Support and resistance levels are based on confirmed pivots — a pivot only appears after the lookahead period has elapsed, which is standard practice for pivot-based tools and avoids false, unconfirmed levels, but it also means levels are inherently a few bars behind the most recent swing.
- Because the script pulls data from higher timeframes via request.security, values on historical bars from an unclosed higher-timeframe candle can adjust intrabar until that higher-timeframe candle closes — as with any multi-timeframe tool, always wait for confirmation on the current higher-timeframe bar before treating a fresh level as final.
- This indicator is a visual and analytical tool for identifying areas of interest; it does not generate buy or sell signals and should be combined with your own risk management and analysis. Nothing here is financial advice. อินดิเคเตอร์

Previous Day, Week & Month Levels [ITA]🟠 OVERVIEW
Previous Day, Week & Month Levels plots the high and low of each completed higher timeframe period and keeps them on the chart until price trades through them. Once a level is taken, it fades to grey instead of disappearing, so the chart separates liquidity that is still resting from liquidity that has already been collected.
The indicator covers daily, weekly and monthly periods independently, with optional midpoints for each range. This lets an intraday trader run daily levels alone, or stack all three groups to see how short-term and higher timeframe references line up.
🟠 CONCEPTS
* Previous Level - The high or low of the last completed daily, weekly or monthly candle, pulled from the higher timeframe regardless of the chart timeframe in use.
* Untaken Level - A level that price has not traded through since its period closed. Drawn at full opacity because the orders resting behind it are still there.
* Taken Level - A level that price has traded through during the current period. Recolored grey to show the liquidity has been collected and the level has lost its role as a target.
* Level Reset - Each group tracks its own taken state and resets when a new period begins. Daily flags clear every session while weekly and monthly flags run on their own cycles.
* Midpoint - The 50% level of a previous range, marking the equilibrium of that period rather than its extremes.
🟠 FEATURES
* Multi-Period Levels - Plots previous day, week and month highs and lows, each group toggleable on its own.
* Taken Level Fading - Automatically recolors any level that price trades through, leaving untouched levels highlighted.
* Optional Midpoints - Adds the 50% level of each enabled range for equilibrium reference.
* Level Labels - Tags each line with its name on the right edge of the chart, with configurable size.
* Level Alerts - Fires when price trades above a previous high or below a previous low.
🟠 HOW TO USE
* Run daily levels alone for intraday work, or enable weekly and monthly for a broader structural view.
* Treat bright levels as unfinished business and faded levels as history. What stays highlighted is where liquidity has not yet been taken.
* Watch for clusters where a daily level sits close to a weekly one. A single move that clears both tends to produce a sharper reaction than clearing either alone.
* Use midpoints as a filter. Price rotating around the midpoint of the previous day often points to balance rather than direction.
* Adjust Extend Right if the levels project too far past the current candle or stop short of it.
🟠 CONCLUSION
Previous Day, Week & Month Levels combines multi-period reference levels with automatic tracking of which levels have already been traded through. Instead of showing every level identically, it separates active liquidity from collected liquidity, giving traders a clear view of which reference points are still relevant to the current session. อินดิเคเตอร์

TrendShift | Supertrend + ADX Regime-Adaptive StrategyOverview
Most Supertrend strategies use one fixed ATR multiplier for every market condition — which means it's either too tight (whipsawed in chop) or too wide (late to catch real trends). TrendShift fixes this by reading market regime in real time with ADX and automatically shifting the Supertrend multiplier to match: tight and responsive when the market is trending, wide and defensive (or disabled entirely) when it's choppy. The strategy essentially "changes gears" as conditions change, and shows you exactly which gear it's in.
Features
ADX-based regime detection — classifies the market as Trending, Choppy, or Neutral, with a built-in hysteresis zone so the regime doesn't flicker back and forth near the threshold.
Dynamic Supertrend multiplier — automatically tightens (fast entries) in trends and widens (fewer false signals) in chop, recalculated live every bar.
Signal gating — Supertrend flips during choppy conditions are suppressed by default; no trades fire on noise.
Risk-based position sizing — every trade risks a fixed % of equity, sized off the actual stop distance (the Supertrend line), so trade size adapts to current volatility automatically.
Trailing stop + optional R-multiple take profit — the Supertrend line itself trails the stop; an optional fixed reward-to-risk target can close the trade early.
Optional chop-flatten & max-bars-in-trade exits — extra safety nets for getting out of dead trades.
Clean, glowing trend line with gradient fill — colored green/red by direction, turns gray and flat in chop, with minimal arrow labels only on actual signal flips (no clutter).
Live dashboard — a small on-chart table showing current Regime, ADX value, Active Multiplier, and Position status, so you can literally watch the strategy shift gears.
How it works
ADX is calculated each bar and compared against two thresholds (default: 25 trending / 20 choppy).
Based on that regime, the strategy picks a tight multiplier (trending) or a wide one (choppy) for the Supertrend calculation — held steady in the neutral zone to avoid jitter.
Supertrend is recalculated using this adaptive multiplier, and a flip in trend direction becomes a trade signal only if the current regime allows new entries.
Position size is calculated from your risk % input and the distance from price to the Supertrend line, so every trade risks roughly the same account %, regardless of how wide the current band is.
The Supertrend line trails your stop; an optional R-multiple limit order banks profit early if enabled.
Tips
Start with the default ADX thresholds (20/25) and multipliers (1.75 tight / 4.5 wide) — they're tuned to be reasonable across timeframes, but always re-check on your specific instrument.
On lower timeframes or noisier symbols, consider raising the choppy threshold or widening the "wide" multiplier further — chop is more common intraday.
Leave "Disable new entries in choppy regime" ON for cleaner equity curves; turn it off if you want to see how the strategy performs without the filter (useful for comparison).
The dashboard's ADX/Multiplier readout is the fastest way to sanity-check whether the strategy is behaving as expected on a given chart — if it feels like it's not trading, check whether it's stuck in "CHOPPY."
Combine with your own higher-timeframe bias filter if you want extra confluence; the strategy doesn't currently check higher-timeframe trend.
This is a strategy script (has backtest results), not just a visual indicator — use the Strategy Tester tab to evaluate performance before live use.
กลยุทธ์

RS Leader - Early Breakout RadarRS Leader - Early Breakout Radar identifies stocks demonstrating exceptional relative strength before a conventional price breakout occurs.
The indicator compares the current symbol with a selectable market benchmark, using SPY by default. It searches for situations in which the relative-strength ratio is near a long-term high while the stock remains in a tight consolidation beneath its previous price high. This combination can help identify securities outperforming the broader market before that leadership becomes obvious from price alone.
RS Leader is different from the RSI oscillator. Its relative-strength calculation is:
Stock Price ÷ Benchmark Price
RS Leader Score
Each stock receives a dynamic score from 1 to 100:
• Relative-strength leadership: 40 points
• Proximity to the breakout level: 20 points
• Price-range contraction: 15 points
• Moving-average structure: 15 points
• Volume behavior: 10 points
A default minimum score of 70 is required before an RS Leader signal can appear. All requirements and scoring thresholds can be adjusted in the indicator settings.
Signal Interpretation
• Blue RS LEADER label: Relative strength is near a long-term high while price remains tightly consolidated below resistance.
• Blue line: The nearby price level that must be exceeded for a potential breakout.
• Green BREAKOUT label: Price closed above the prior resistance level following an active RS Leader setup.
• Blue background shading: Optional highlighting of bars that currently satisfy the complete setup.
Dashboard Colors
• Green: Condition is favorable or confirmed.
• Blue: An active RS Leader setup meets the minimum score.
• Orange: Condition is developing, neutral or requires caution.
• Red: Condition is not currently satisfied.
The dashboard displays the current RS Leader Score, relative-strength status, distance from the price high, consolidation width, moving-average alignment, relative volume and selected benchmark.
The indicator uses confirmed closing-bar information and does not intentionally use future data. Signals can still fail, and historical relationships do not guarantee future results. Relative strength may deteriorate, apparent breakouts may reverse, and market or company-specific events can materially affect price behavior.
RS Leader is provided solely for educational and informational purposes. It does not constitute investment advice, a recommendation to buy or sell any security, or a guarantee of future performance. Users should independently evaluate market conditions, liquidity, earnings dates, volatility and personal risk tolerance before making any financial decision. อินดิเคเตอร์

Trend Quality Index [StrixEDGE]📊 WHAT IT DOES
StrixEDGE Trend Quality Index answers the question most trend indicators ignore: not just whether a trend exists, but how good it is. It produces a 0-100 composite score measuring trend quality across four dimensions — velocity, strength, clarity, and multi-timeframe agreement.
🔬 WHY IT'S DIFFERENT
ADX tells you trend strength. Supertrend tells you direction. Neither tells you the complete quality picture. TQI combines four independent metrics: LSMA velocity (how fast the trend moves), ADX with DI gap analysis (how strong and directionally clear), Vortex Indicator separation (how unambiguous the direction), and triple Supertrend agreement (how many timeframe perspectives agree). A trend scoring 90+ on all four dimensions is far more tradeable than one scoring well on just one.
⚙️ HOW IT WORKS
Four scores, each 0-25 points, summed and smoothed:
• LSMA Velocity: Linear regression slope speed, normalized by ATR. Faster trends score higher.
• ADX Strength: ADX value mapped to 0-20, plus a bonus for wide DI+/DI- gap (clearer direction).
• Vortex Clarity: Distance between VI+ and VI- lines. Wider = more decisive trend.
• Supertrend Agreement: Three Supertrends (fast/medium/slow) — all aligned = 25, two = 15, split = 5.
📈 HOW TO USE
• TQI 80-100: EXCELLENT — aggressive trend-following, wide targets
• TQI 60-80: GOOD — standard trend trades, normal position sizing
• TQI 40-60: FAIR — cautious entries, tight stops, reduced size
• TQI below 40: POOR — avoid trend strategies, consider range setups instead
• Direction arrows show which way the quality trend points
🎛️ INPUTS & DEFAULTS
LSMA: 20/5 | ADX: 14 | Vortex: 14 | Supertrend: 7/2, 10/3, 14/4 | Smooth: 3
═══════════════════════════════════════════════════════
🔧 CUSTOMIZATION
All parameters are fully adjustable through the indicator settings panel. Inputs are grouped logically:
• ⚙️ Core Parameters — main calculation settings
• 📊 Table Settings — table size (Tiny to Huge), position (4 corners), visibility toggle
• 🎨 Visual Settings — colors, show/hide elements
• 🔔 Alert Settings — threshold values for notifications
📊 DATA TABLE
A built-in data table displays all key metrics in real-time. Adjust the table size from Tiny to Huge to match your chart layout. Position it in any corner. Toggle visibility on/off.
🔔 ALERTS
Pre-built alert conditions for all major signals. Set up alerts via TradingView's alert dialog — select this indicator and choose from the available conditions.
⏱️ RECOMMENDED TIMEFRAMES
Works on all timeframes. Recommended: 1H, 4H, Daily for best signal quality. Lower timeframes produce more signals but with higher noise. Weekly/Monthly for position trading context.
✅ COMPLIANCE
• No repainting — all signals based on confirmed bar close data
• No future data references
• Open-source code — verify the logic yourself
⚠️ DISCLAIMER
This indicator is a technical analysis tool, not financial advice. It does not predict future price movements. Past patterns and signals do not guarantee future results. Trading involves substantial risk of loss. Always use proper risk management, including stop losses and appropriate position sizing. Never risk more than you can afford to lose. อินดิเคเตอร์
