FootprintKitAnalysis toolkit for the native footprint API introduced in Pine v6. It turns a `footprint` object into aggregated row statistics, price-interval measurements, low and high volume node runs, stacked imbalances, unfinished auction reads, absorption reads and multi-bar composite profiles.
It is written for script authors who build their own footprint tools and who would otherwise re-implement the same row loops in every script.
WHY THE LIBRARY NEVER CALLS request.footprint()
Pine allows only one unique footprint request per script. If the library issued that request internally it would consume the caller's single slot, and the importing script could no longer query the footprint on its own terms. So the caller makes the one allowed call and passes the resulting object into every function.
The consequence is that the library performs no requests, draws nothing and keeps no persistent state outside the Profile object you create yourself. There is nothing in it that can repaint.
WHAT IT COMPUTES THAT THE API DOES NOT EXPOSE
- Stacked imbalances. The API flags imbalance per row; the stack of consecutive flagged rows is what carries meaning in footprint reading, and it has to be assembled.
- Unfinished auction at the extremes of a bar, i.e. an extreme row that still shows trade on both sides.
- Volume traded inside an arbitrary price interval, with rows that only partly overlap the interval counted pro rata.
- Runs of thin rows, the price pockets a move passed through without trade, and runs of heavy rows, the shelves inside the bar.
- A composite profile across several bars with its own point of control and value area. request.footprint() returns one bar at a time; feeding successive bars into a Profile builds the multi-bar picture the single call cannot give.
- Distribution shape metrics that read the whole profile rather than only its peak.
FORMULAS
Aggressive volume per row and per interval is derived from total volume V and delta D as buy = (V + D) / 2 and sell = (V - D) / 2. This is exact by the definition of delta and avoids depending on optional per-row accessors.
slice() weights each row by the fraction of its height that falls inside the requested interval, k = overlap / rowHeight, clamped to 1. Counting a boundary row either whole or not at all is the usual source of error in hand-written versions.
concentration() is POC row volume divided by mean row volume. A value near 1 means volume was spread evenly, a high value means one price row absorbed most of the activity.
dispersion() is the Shannon entropy of the row volume distribution, normalised by ln(n) to the 0 to 1 range: H = -sum(p * ln p) / ln(n), where p is a row's share of bar volume. Zero means all volume sat in one row, one means a perfectly even spread. Unlike concentration it distinguishes a bar with two heavy rows from a bar with one.
deltaCentroid() returns the centre of mass of absolute delta as a fraction of the bar range from the low, showing where aggression concentrated regardless of which side was aggressive.
absorption() splits the bar range into thirds, measures each extreme third with slice(), and reports absorption when a third holds at least the requested share of bar volume while its delta points against the direction of the bar. Aggression that meets size and fails to move price is the signature of a passive participant taking the other side.
The composite value area grows outward from the point of control, repeatedly taking the heavier of the two neighbouring buckets until the requested share of total volume is enclosed.
USAGE
import Smart-Day-Trader/FootprintKit/1 as fpk
footprint fp = request.footprint(4, 70, 300)
fpk.RowStats s = fpk.stats(fp)
float conc = fpk.concentration(s)
float pos = fpk.pocPosition(s, high, low)
array voids = fpk.runs(fp, s, 0.4, 3, true)
= fpk.wicks(fp, open, high, low, close)
NOTES
A plan with footprint data access is required for the data itself; the library compiles on any plan because it makes no requests.
Choose ticks per row relative to the instrument's tick size rather than copying a default. On NASDAQ 100 E-mini futures the tick is 0.25 points, so 4 ticks per row equals one point and yields roughly 20 to 30 rows on a 5 minute bar. A value of 20 there would collapse the same bar into 4 rows, at which point concentration, entropy and row runs stop carrying information.
All functions accept a na footprint and return empty or na results rather than failing, so they are safe to call on bars without data.
REFERENCE
stats(fp)
Aggregates every row of a footprint in a single pass: totals, POC, delta,
imbalance counts and the price bounds actually covered by rows. Reading these values
one by one costs several loops over the same array; this does it once.
Parameters:
fp (footprint) : Footprint object returned by request.footprint(). Safe to pass na.
Returns: A RowStats object. When the footprint is na or empty, `n` is 0 and the
float fields are na.
concentration(s)
Concentration of the bar's volume: POC row volume divided by the mean row
volume. A value near 1 means volume was spread evenly across the bar; a high value
means a single price row absorbed most of the activity.
Parameters:
s (RowStats) : RowStats produced by stats().
Returns: The ratio, or na when statistics are empty.
dispersion(fp, s)
Normalised Shannon entropy of the volume distribution across rows, scaled to
0 to 1. Zero means all volume sat in one row, one means perfectly even spread. Unlike
concentration() this reads the whole shape rather than just the peak, so a bar with
two heavy rows is distinguished from a bar with one.
Parameters:
fp (footprint) : Footprint object.
s (RowStats) : RowStats produced by stats() for the same footprint.
Returns: Entropy in the 0 to 1 range, or na when fewer than two rows carry volume.
pocPosition(s, barHigh, barLow)
Where the POC sits inside the bar's range, as a fraction from the low.
0 places the heaviest row at the low of the bar, 1 at the high.
Parameters:
s (RowStats) : RowStats produced by stats().
barHigh (float) : High of the bar.
barLow (float) : Low of the bar.
Returns: Position clamped to 0 to 1, or na when the range is degenerate.
deltaCentroid(fp, barHigh, barLow)
Centre of mass of absolute delta inside the bar, as a fraction from the low.
Shows where aggression was concentrated regardless of which side was aggressive,
which often differs from where total volume sat.
Parameters:
fp (footprint) : Footprint object.
barHigh (float) : High of the bar.
barLow (float) : Low of the bar.
Returns: Position in the 0 to 1 range, or na when there is no delta to weight by.
slice(fp, priceA, priceB)
Volume traded inside an arbitrary price interval. Rows that only partly
overlap the interval are counted in proportion to the overlapped fraction of their
height, so the result is correct even when the interval boundaries fall mid-row.
This is the primitive behind wick, zone and level measurements.
Parameters:
fp (footprint) : Footprint object.
priceA (float) : One boundary of the interval. Order does not matter.
priceB (float) : The other boundary of the interval.
Returns: A Slice object. All fields are 0 and `share` is na when nothing overlaps.
wicks(fp, o, h, l, c)
Splits the bar's volume into upper wick, body and lower wick using slice(),
so partially overlapped rows are handled correctly. An empty upper wick slice on a
bar with a long upper shadow means price travelled there without trading size, which
reads very differently from a wick that carries volume.
Parameters:
fp (footprint) : Footprint object.
o (float) : Open of the bar.
h (float) : High of the bar.
l (float) : Low of the bar.
c (float) : Close of the bar.
Returns: A tuple of Slice objects.
runs(fp, s, ratio, minRun, below)
Finds every group of consecutive rows whose volume is below or above a
multiple of the bar's mean row volume, and returns them as price spans. With
below = true this locates thin rows, the price pockets a move passed through without
trade; with below = false it locates the heavy shelves inside the bar.
Parameters:
fp (footprint) : Footprint object.
s (RowStats) : RowStats produced by stats() for the same footprint.
ratio (float) : Multiplier applied to the mean row volume to form the threshold.
minRun (int) : Minimum number of consecutive rows required to report a span.
below (bool) : When true, keep rows at or below the threshold; when false, at or above.
Returns: An array of Span objects, ordered as the rows are ordered. Empty when nothing
qualifies.
stacks(fp, minRun, buySide)
Finds stacked imbalances: runs of consecutive rows all flagged on the same
side. The native API exposes the flag per row, but the stack is what carries meaning
in footprint reading, and stacks have to be assembled by hand.
Parameters:
fp (footprint) : Footprint object.
minRun (int) : Minimum number of consecutive flagged rows to report, commonly 3.
buySide (bool) : When true, collect buy imbalance stacks; when false, sell imbalance stacks.
Returns: An array of Span objects covering each stack. Empty when none reach minRun.
unfinished(fp, tol)
Tests the extreme rows for an unfinished auction: an extreme that still shows
trade on both sides, meaning the move stopped before either side was cleared out.
A finished extreme has one side at or near zero.
Parameters:
fp (footprint) : Footprint object.
tol (float) : Fraction of the extreme row's own volume below which a side counts as empty.
Use 0 for a strict test, or a small value such as 0.05 to tolerate noisy feeds.
Returns: A tuple of booleans. Both false when the footprint is empty.
absorption(fp, s, o, c, minShare)
Reads absorption at the extremes of the bar: one third of the bar's range
holding a large share of the volume with delta pointing against the bar's direction.
Aggression that meets size and fails to move price is the signature of a passive
participant taking the other side.
Parameters:
fp (footprint) : Footprint object.
s (RowStats) : RowStats produced by stats() for the same footprint.
o (float) : Open of the bar.
c (float) : Close of the bar.
minShare (float) : Minimum share of bar volume the third must hold, for example 0.4.
Returns: 1 when sellers were absorbed at the lows of an up bar, -1 when buyers were
absorbed at the highs of a down bar, 0 otherwise.
newProfile(step)
Creates an empty composite profile. request.footprint() delivers one bar at a
time; feeding successive bars into a profile builds the multi-bar picture the single
call cannot give on its own.
Parameters:
step (float) : Price bucket height. Use the row height from RowStats to keep the composite
at the same resolution as the footprint itself.
Returns: An empty Profile object.
method feed(p, fp)
Folds one bar's rows into the profile. Buckets are keyed by rounded row
midpoint and kept sorted, so repeated calls stay ordered and lookups stay cheap.
Call once per confirmed bar.
Namespace types: Profile
Parameters:
p (Profile) : Profile to update, modified in place.
fp (footprint) : Footprint object for the bar being added.
Returns: Nothing. The profile is mutated.
method sum(p)
Total volume held by the profile.
Namespace types: Profile
Parameters:
p (Profile) : Profile to read.
Returns: Sum of all bucket volumes, or 0 when the profile is empty.
method poc(p)
Point of control of the composite profile.
Namespace types: Profile
Parameters:
p (Profile) : Profile to read.
Returns: Centre price of the heaviest bucket, or na when the profile is empty.
method valueArea(p, pct)
Value area of the composite profile, grown outward from the point of control
by repeatedly taking the heavier neighbouring bucket until the requested share of
total volume is enclosed.
Namespace types: Profile
Parameters:
p (Profile) : Profile to read.
pct (float) : Share of total volume to enclose, expressed 0 to 1, for example 0.7.
Returns: A tuple of prices, both na when the profile is empty.
method reset(p)
Empties the profile while keeping its bucket size, ready for a new window.
Namespace types: Profile
Parameters:
p (Profile) : Profile to clear, modified in place.
Returns: Nothing. The profile is mutated.
RowStats
Aggregated statistics for every row of a single bar's footprint.
Fields:
n (series int) : Number of rows. Zero when the footprint holds no data.
total (series float) : Sum of row volume across the bar.
avg (series float) : Mean volume per row.
maxVol (series float) : Volume of the heaviest row, i.e. the POC row.
minVol (series float) : Volume of the lightest row.
pocVol (series float) : Same as maxVol, kept for readability at call sites.
pocTop (series float) : Upper price bound of the POC row.
pocBot (series float) : Lower price bound of the POC row.
pocMid (series float) : Midpoint of the POC row.
pocIdx (series int) : Index of the POC row inside the rows array, -1 when empty.
buy (series float) : Aggressive buy volume of the bar, derived as (total + delta) / 2.
sell (series float) : Aggressive sell volume of the bar, derived as (total - delta) / 2.
delta (series float) : Net delta of the bar summed across rows.
buyImb (series int) : Count of rows flagged as buy imbalances.
sellImb (series int) : Count of rows flagged as sell imbalances.
top (series float) : Highest price covered by any row.
bot (series float) : Lowest price covered by any row.
rowH (series float) : Height of one row in price units.
Span
A contiguous group of rows inside one bar, reported as a price span.
Fields:
top (series float) : Upper price bound of the span.
bot (series float) : Lower price bound of the span.
idxA (series int) : Index of the first row of the span.
idxB (series int) : Index of the last row of the span.
count (series int) : Number of rows in the span.
vol (series float) : Total volume inside the span.
delta (series float) : Net delta inside the span.
Slice
Volume measured over an arbitrary price interval, with partial rows counted pro rata.
Fields:
total (series float) : Volume inside the interval.
buy (series float) : Aggressive buy volume inside the interval.
sell (series float) : Aggressive sell volume inside the interval.
delta (series float) : Net delta inside the interval.
share (series float) : Interval volume divided by the bar's total volume, 0 to 1.
Profile
Composite volume profile accumulated from several bars' footprints.
Fields:
step (series float) : Price bucket size. Rows are folded into buckets of this height.
price (array) : Bucket centre prices, kept sorted ascending.
vol (array) : Volume per bucket, index-aligned with `price`.
dlt (array) : Delta per bucket, index-aligned with `price`.
Libreria

Market Transition Pressure EngineMarket Transition Pressure Engine is a behavioral-state framework designed to evaluate whether current market behavior remains relatively stable or is developing internal pressure consistent with a potential state transition.
Rather than attempting to predict the direction of the next move, the framework measures changes occurring inside the current market environment and organizes that evidence into a confirmed lifecycle.
How It Works
The engine evaluates five normalized behavioral dimensions:
• Directional Efficiency Shift — measures how current directional efficiency differs from its behavioral baseline.
• Volatility Shift — evaluates changes in ATR-normalized volatility conditions.
• Structural Persistence Deterioration — measures whether recent directional persistence is weakening relative to its baseline.
• Directional Conflict — identifies disagreement between shorter-term directional behavior and the broader directional baseline.
• Range Shift — evaluates changes in local price-range behavior relative to its longer baseline.
These components are combined into a normalized Transition Pressure measure.
The pressure value represents the degree of behavioral instability detected by the framework. It is not a probability of reversal or continuation.
Pressure Lifecycle
The framework organizes transition pressure into five states:
STABLE — transition evidence remains comparatively limited.
BUILDING — internal behavioral changes are beginning to accumulate.
ELEVATED — multiple components are producing stronger transition-pressure evidence.
CRITICAL — transition pressure has reached a comparatively high state under the framework.
RELEASED — previously elevated pressure has subsequently contracted sufficiently to register a confirmed pressure release.
RELEASED is a temporary lifecycle state rather than a directional conclusion.
Confirmation and State Persistence
Lifecycle changes are evaluated using confirmed bars.
Both upgrades and downgrades require persistence before a replacement state is confirmed. This helps reduce one-bar state switching and distinguishes a developing candidate state from an established lifecycle state.
The information panel therefore separates:
STATE — current confirmed pressure state.
PRESSURE — confirmed normalized pressure measurement.
LIFECYCLE — whether the state is confirmed or a replacement is developing.
CANDIDATE — the developing replacement state when applicable.
TIMING — identifies the confirmed-bar basis of the displayed lifecycle information.
Adaptive Pressure Bands
The chart visualization uses an adaptive behavioral field around price.
Its width responds to ATR-normalized volatility and the engine's measured transition pressure. Lower-pressure environments generally produce a more subdued field, while increasing pressure changes the structure and visual emphasis of the bands.
Boundary proximity can also receive additional visual emphasis.
The bands are analytical context. They are not price targets, support/resistance guarantees, or projected future ranges.
Originality and Intended Use
Market Transition Pressure Engine is built around the interaction between behavioral baselines, normalized feature shifts, composite transition pressure, symmetric state confirmation, pressure-release detection and lifecycle persistence.
Its analytical focus is not conventional trend direction or entry generation.
The primary question is:
Is the current behavioral environment remaining stable, or is measurable internal pressure for a state change developing?
This distinction allows transition pressure to be studied separately from market direction.
Calculation Timing
Lifecycle decisions use confirmed-bar information.
The dashboard reports confirmed measurements so the displayed pressure value and confirmed lifecycle state are based on the same information set.
The adaptive visual field may continue developing during the current bar, while lifecycle confirmation intentionally waits for confirmed information.
This confirmation delay is part of the methodology.
Limitations
Transition-pressure states describe measured behavioral conditions; they do not represent reversal probabilities, continuation probabilities, expected returns, or guaranteed future outcomes.
A CRITICAL state does not necessarily mean that price will reverse.
A STABLE state does not imply that a significant move cannot occur.
Results depend on the selected market, timeframe, available history and settings. ATR normalization improves comparability across volatility environments but does not make different instruments behaviorally identical.
Historical state transitions do not imply that future transitions will develop in the same manner.
The indicator is intended as an analytical and research framework and should be interpreted alongside broader market context. Indicatore

SpxSnipper - Intraday Candle vs Daily ATRIntraday Candle vs Daily ATR
This indicator is designed to identify significant intraday candles by comparing each intraday candle’s size against the Daily ATR.
It is useful for traders who want to quickly spot unusually large 5-minute, 15-minute, or 30-minute candles relative to the stock/index’s normal daily volatility.
How it works:
The indicator pulls Daily ATR data from the daily timeframe and applies it to the intraday chart. Each intraday candle is then measured as a percentage of the Daily ATR.
For example:
If the Daily ATR is 100 points and the selected threshold is 25%, the indicator will mark any intraday candle with a range or body greater than 25 points.
Main features:
- Uses Daily ATR on intraday charts
- Custom ATR length
- Custom percentage threshold
- Option to measure full candle range or real body
- Option to use previous completed Daily ATR or current developing Daily ATR
- Bullish and bearish candle signals
- Optional candle coloring
- Optional percentage labels
- Alert conditions included
Measurement modes:
- Full Candle Range: high minus low
- Real Body: absolute difference between close and open
Suggested use:
This tool can help identify important impulse candles, volatility expansion, breakout candles, rejection candles, and strong intraday moves.
It can be used on SPX, SPY, QQQ, individual stocks, futures, or other liquid instruments.
For 15-minute charts, a threshold around 20%–25% of Daily ATR can highlight only the more important candles. Lower values will generate more signals, while higher values will show only the strongest volatility candles.
This indicator is intended for discretionary trading analysis and should be used together with price action, trend, support/resistance, VWAP, volume, and proper risk management.
Not financial advice. Indicatore

Amit## Strategy Overview
This strategy is a price-action-based intraday trading system designed to identify high-probability entries using **market structure, CHoCH (Change of Character), BOS (Break of Structure), liquidity sweeps, and multi-timeframe confirmation**.
The strategy focuses on letting the market establish its direction first rather than entering immediately on a breakout. Once structure confirms the move, the lower timeframe is used to identify a more precise entry.
### How It Works
The strategy primarily follows this sequence:
**1. Higher-Timeframe Structure**
* Identifies a Change of Character (CHoCH) to establish a potential directional bias.
* Looks for confirmation through a Break of Structure (BOS).
**2. Lower-Timeframe Confirmation**
* After higher-timeframe confirmation, the strategy moves to the lower timeframe.
* A corresponding CHoCH is identified in the same direction.
**3. Liquidity Sweep**
* The strategy waits for price to sweep the relevant structure/liquidity.
* The sweep helps avoid entering immediately into a false breakout.
**4. Entry**
* Once the required structure and liquidity conditions are satisfied, the strategy generates a long or short signal.
### Trading Philosophy
The core idea is:
**Structure → Confirmation → Liquidity Sweep → Entry**
Instead of chasing price after a breakout, the strategy waits for the market to confirm its intention and then looks for an entry after liquidity has been taken.
### Important Note
This is a systematic strategy designed for backtesting and research. Results can vary depending on market conditions, execution, slippage, commissions, and the instrument being traded.
Past backtest performance does not guarantee future results. Always test the strategy thoroughly before using it with real capital.
Strategia

Advanced kNN Dip Pattern [The Quant Science]Advanced kNN Dip Pattern is designed to identify significant price drops and evaluate their bounce probability using historical past patterns through our kNN Lorentzian Classification machine learning library.
To train the machine learning model, the script extracts and normalizes four fundamental geometric metrics of each candle using a fifty-period min-max scaling function.
🔹 The first feature is the candle body size , calculated as the absolute value between the close and the open.
🔹 The second feature is the total candle range , defined by the difference between the high price and the low price.
🔹 The third and fourth features measure the wicks instead, calculating respectively the space between the high and the highest point between the close and the open for the upper wick, and the distance between the lowest point between the close and the open and the low for the lower wick.
👉 About our kNN Lorentzian Classification Library:
🔷 What It Does
The script analyzes real-time candle structure and detects sudden downturns by comparing them against a dynamic historical database.
Detects the dip by monitoring the market for user-defined percentage drops relative to the recent high price.
Performs kNN classification by extracting four geometric candle features, namely body size, total range, upper wick, and lower wick, normalizing them, and comparing them with historical patterns through the algorithm.
Finally, applies a signal filter , generating an entry only when a significant drop occurs in conjunction with a positive prediction based on the most similar historical neighbors.
🔷 What It Is Used For
This indicator is a key tool for mean reversion and dip buying strategies.
Helps filter out false crashes by distinguishing healthy, high-probability bounce corrections from strongly bearish trends.
The automatically drawn boxes and lines also allow you to visually assess the extent of the movement and price reaction in historical tests.
Thanks to the percentage confidence, the trader also knows how closely the current pattern historically resembles winning setups.
🔷 Who Uses It
Quantitative and systematic traders who want to leverage statistical classification models without leaving the TradingView environment.
Swing traders looking for optimal entry points on volatile assets such as cryptocurrencies or growth stocks during market correction phases.
Algo-trading enthusiasts interested in understanding how to implement matrices, arrays, and external libraries in Pine Script v6.
🔷 How to Use It
Add the script to your chart , which requires importing the dedicated library.
Configure the main parameters in the settings panel by defining the analysis period in bars and the minimum percentage drawdown threshold required to trigger the analysis.
Monitor the chart , and when the signal turns on, the script colors the bar, draws a transparent box highlighting the magnitude of the drop from the peak to the low, and prints an HUD label with the statistical details.
🔷 User Interface Management
Configure the main parameters in the settings group by defining the Analysis Period expressed in bars, set to a default of 2, and the percentage Dip Threshold, set to a default of -5 percent.
Analysis Period indicates the number of bars the script considers to calculate the recent high price against which the drawdown is measured.
Dip Threshold represents the minimum percentage price drop threshold required for the system to recognize a movement as a valid dip and initiate the machine learning analysis.
Machine Learning Vs. Traditional Dip Patterns
Traditional patterns historically suffer from the severe flaw of triggering right in the middle of strong downward trends, catching what is jargon-wise called the falling knife and leading to massive losses. The integration of k Nearest Neighbors in this script brilliantly overcomes this limit by analyzing the geometric microstructure of the candle and comparing it with thousands of past events. The system does not merely observe how far the price has dropped, but evaluates whether that precise candle profile historically has a good probability of generating a bounce or if it instead anticipates a prolonged collapse, filtering out false signals and protecting capital.
Below you can find a quickly comparison analysis between a classic Dip and a kNN Dip.
To do that, we used our Dip & Rip Patterns indicator:
Indicatore

DCA HelperDisciplines your DCA strategy by splitting your buy zone into N pre-calculated levels. Triggers buy signals only when price touches a level within the discount zone.
How it works:
The indicator automatically divides the discount zone (bottom 20% of a 50-bar range) into N equal parts. Each part is a potential DCA entry (L1, L2, ..., LN). Signals fire ONLY when price touches a specific level — never in "no man's land" between levels.
Entry filters (all must pass):
Price below both MA(50) AND MA(200) → double trend confirmation
RSI(14) below 35 → oversold filter
Price within bottom 20% of range (discount zone)
Price sustained in discount for 3 consecutive bars (anti-spike)
20-bar cooldown between signals
Within 0.5% of a level (no in-between triggers)
Chart visualization:
🟩 Light green box = discount zone (where levels operate)
🟦 Blue dashed box = full high/low range (context)
➕ White dotted line = 50% equilibrium level
🟧 Orange line = average DCA price
🔷 Green "DCA" diamond below bar = each executed level
🟢➖🟢 Horizontal green lines = the N levels, labeled L1 price (% vs current), L2 ..., etc.
Level color: more intense the deeper (better price)
Info table (top-right):
Now: current price
Avg: current average + # buys/N
Complete: average if ALL N levels fill (ideal position avg)
L1, L2, ..., LN: each level price + % vs current, colored by risk:
🟢 Green = close (entry ready)
🟠 Orange = medium
🔴 Red = far below (better discount but more waiting)
Configurable inputs:
DCA levels (1-10) — number of staggered buys
Trigger proximity to level (%) — max distance for level trigger
Filter MA length (fast/slow)
RSI buy level
Range lookback
Discount threshold
Sustained bars
Min bars between signals
How to use for real DCA:
1.
Check the "Complete" row in the table → that's your avg if you split position across N levels
2.
Decide total size (e.g., $10k) and divide into N parts
3.
Set alerts on "DCA" diamonds for each level
4.
Buy the corresponding part when each level triggers Indicatore

Volume Footprints**Footprints (Volume Footprints) — Description**
Footprints breaks down each price bar to show where trading activity concentrated within it. Instead of a single volume number per bar, it splits a bar into horizontal price levels and reports how much volume traded at each level, along with an estimated buy/sell breakdown. Everything is presented in a compact, docked information box rather than drawn across the chart, keeping the price panel clean. The indicator's full name is "Volume Footprints," shown in the library and settings, while the chart legend displays the short name "Footprints."
**What it shows**
The indicator samples a finer timeframe inside each bar to reconstruct how volume was distributed across price. It then displays that distribution as a price ladder, with the highest price at the top. For each level it shows the volume attributed to buying, the volume attributed to selling, and the net difference between them (delta). A totals row at the bottom sums buying, selling, and net delta for the whole bar.
Two reference points are marked with colored dots in their own narrow columns: the Point of Control (P), which is the single price level where the most total volume traded, and the current price level (C), which shows where live price sits within the bar. A volume heatmap shades each row so that busier levels appear more saturated, making the most active prices easy to spot at a glance.
An optional candlestick column runs down the far-left side of the box, drawn to scale against the same price ladder so it mirrors the inspected bar's candle on the chart — a solid body between the open and close, thin wicks to the high and low, and colored green when the bar closed up or red when it closed down. Because it is drawn from table cells, its smoothness depends on how many rows the ladder has; a coarse ladder produces a blockier candle.
The information box also carries a title row showing the indicator name, which bar is being examined, the timeframe settings in use, and a live countdown to the close of the forming bar.
**Buy/sell estimation**
The buy and sell figures are estimated from price direction within the sampled sub-bars rather than from actual bid/ask transaction data. Rising sub-bars are counted as buying and falling sub-bars as selling. As a result, the buy, sell, and delta values are an approximation of activity, not a measurement of true order flow.
**Timeframe guidance and warnings**
For the indicator to work, the chart timeframe must sit between the two timeframe settings: the cell granularity must be below the chart timeframe, and the footprint bar timeframe must be at or above it. If the chart is on a higher timeframe than the footprint setting, the box displays a warning in place of the ladder. If the cell granularity is not below the chart timeframe, the box reports that as well. The footprint timeframe may also be left as "Chart" to match the chart's own timeframe, in which case no timeframe warning is shown.
**User Inputs**
- **Footprint bar timeframe** — Sets which bar the box analyzes, such as one hour. This should be at or above the chart's timeframe. Volume from finer sub-bars is accumulated across chart bars until this bar completes, then organized into price levels.
- **Cell granularity** — Sets the finer timeframe used to build the price levels inside each bar. This must be below the chart's timeframe; otherwise no data is returned and the box reports this.
- **Stable cells (closed sub-bars only)** — Affects the forming bar only. When on, buy/sell figures count only sub-bars that have fully closed, so numbers accumulate steadily instead of shifting between buy and sell as price moves; this introduces a slight lag at the live level. When off, the still-forming sub-bar is included for maximum responsiveness, at the cost of the current level's figures fluctuating.
- **Row bucketing mode** — Chooses how price levels are formed. Fixed price step builds a continuous ladder on a fixed price grid, giving every level from the bar's low to high a permanent row that does not shift as the bar develops. Range slices instead divides the bar's high-to-low range into a set number of equal parts, which rescales as the bar's range grows.
- **Price step (ticks)** — Used in Fixed price step mode. Sets the height of each row in ticks. Smaller values create more, finer rows; larger values create fewer, coarser rows. If a bar spans more levels than the display can hold, the highest levels are truncated, which is resolved by raising this value.
- **Price rows (Range slices mode)** — Used in Range slices mode. Sets the number of equal divisions of the bar's range. It has no effect in Fixed price step mode, which sizes the ladder automatically.
- **Footprint bar to inspect** — Selects which bar the box displays, counting back from the newest. Zero is the bar currently forming, one is the last completed bar, and so on.
- **Info box position** — Anchors the information box to a chosen area of the chart, such as a corner or middle edge, so it can be moved clear of price.
- **Info box text size** — Sets the font size inside the box, from tiny to large.
- **Show candlestick column** — Toggles the far-left candlestick column. When off, the column is removed entirely and the box narrows.
- **Show chart marker** — Toggles an on-chart arrow that points to the most recent candle of the bar being analyzed.
- **Marker color** — Sets the color of that on-chart arrow.
- **Buy color** — Sets the color used for net-buying delta figures.
- **Sell color** — Sets the color used for net-selling delta figures.
- **Candle up color** — Sets the candlestick column's color when the bar closed at or above its open. Defaults to a standard chart green.
- **Candle down color** — Sets the candlestick column's color when the bar closed below its open. Defaults to a standard chart red.
- **Heat (volume) tint** — Sets the hue of the volume heatmap that shades each row by activity, with the busiest level appearing brightest.
- **Info box background** — Sets the solid background color of the box, over which the heatmap tint blends.
- **Text** — Sets the color of the text inside the box.
- **Title text color** — Sets the color of the title-row text.
- **Title background** — Sets the background color of the title row.
- **POC dot color** — Sets the color of the dot marking the Point of Control.
- **Current price dot color** — Sets the color of the dot marking the row where live price currently sits. Indicatore

Winchester 10X1T Cipher - Zone-Gated WaveTrend DotsWHAT THIS IS
A single-pane momentum panel that marks the exact bar on which a WaveTrend cycle turns while price sits in an extreme zone. It is a confluence display: WaveTrend for the cycle turn, an RSI+MFI pressure band for money-flow context, RSI for the trend regime, and a Stochastic RSI pair for the short-term swing. All four sit in one pane, so a trader does not have to read four windows to answer one question: is this turn happening in a place where a turn matters?
HOW IT IS CALCULATED
WaveTrend follows the classic construction published by LazyBear: an EMA of the source (HLC3, channel length 9), an EMA of the absolute distance to it, a channel index scaled by 0.015, then an EMA of that index (length 12) as the fast line and a 3-period SMA of the fast line as the signal line. The area between both lines is filled so the cycle body is visible at a glance.
The pressure band uses the RSI+MFI area concept popularised by VuManChu's Cipher B: the average of (close-open)/(high-low) over 60 bars, scaled and drawn as a band at the bottom of the pane - white above zero, gold below.
RSI (14) is plotted in three states: white at or below 30, gold at or above 60, purple in between.
Stochastic RSI (14/14, K and D smoothed by 3) is plotted on a log-transformed source.
THE DOTS
A dot is printed only when the WaveTrend fast line crosses its signal line AND the signal line is already inside an extreme zone. Two sizes are used on each side, so the quality of the location is visible without reading numbers:
- Small dot: the cross happens between the first and the second zone (53 to 60 above, -53 to -60 below).
- Large dot: the cross happens beyond the second zone (60 and above, -60 and below).
Top dots are sky blue; bottom dots are white with a gold core. Each of the four dot types has its own alert condition.
WHY THE COMBINATION
WaveTrend on its own crosses constantly in the middle of the range, which is where most of its false signals live. Gating the cross on the zone removes those. The RSI colour states and the pressure band then answer the second question - whether the turn is a counter-trend stab or a continuation in the direction of the dominant flow. RSI at 60+ (gold) with a top dot is a different situation from RSI at 30 (white) with a bottom dot, and the panel shows both facts on the same bar without adding a second indicator.
HOW TO USE IT
Add it to any symbol and any timeframe. Nothing repaints once a bar has closed, so wait for the bar to close before acting on a dot. Treat the large dots as the primary event and the small dots as early warnings. All lengths, zone levels and visibility switches are inputs, so the zones can be tightened or widened per market. The four alert conditions can be wired to TradingView alerts.
CREDITS
The WaveTrend oscillator is the open-source work of LazyBear; the RSI+MFI area concept comes from VuManChu's open-source Cipher B. This script re-implements both in Pine v6 and adds the zone-gated two-size dot logic, the RSI regime colouring, the combined pane layout and the alert set. It is published open source so that anyone can read exactly what it does. Indicatore

Balanced Price Range (M1D)Balanced Price Range
Marks one thing and refuses to mark anything else: the band of untraded price left where two opposing fair value gaps overlap, when price displaced straight back through the first gap without ever testing it. If the gap was tested first, no zone is drawn — that is an inversion, and it is a different event.
Most tools that draw a balanced price range take any bullish gap and any bearish gap, intersect them, and paint the overlap. That also fires on inversions, because an inverted gap and a fresh opposing gap produce the same geometry. This one starts from what happened at the first gap and works forward, so the two are never confused.
What separates a BPR from an inversion
A fair value gap is read over three candles and has to clear a minimum size in ticks to be watched at all. Once it is being watched, the first candle to reach its consequent encroachment decides everything, and there are only three outcomes.
The candle reaches the midpoint and closes on the respecting side of it, or closes inside the gap: the gap has been tested. It held, or price accepted inside it, and either way something happened there. It is dropped from this tool for good and can never produce a zone.
The candle reaches the midpoint and, on that same candle, closes its body clean past the far edge: no test. Nothing ever held inside it. The gap was transited in one move, and it stays in play.
The candle trades into the gap but never reaches the midpoint, then closes back outside: a probe. Nothing was proven at the midpoint, so the gap stays in play — but the wick counts, and the section on the drawn zone explains what it does.
That first distinction is the whole indicator. A tested gap that later fails is an inversion; an untested gap that is displaced straight through is what this draws.
The pivot is the window
Two opposing gaps that merely overlap are not a balanced price range. The formation is a tight swing — an inverted V or U for a bearish zone, a V or U for a bullish one — and the displacement back begins as the swing completes.
So a pivot has to sit between the gap forming and the gap being broken, and the break has to follow that pivot closely. Both are settings: the pivot length, where three candles give the sharp V and five the rounded U, and the number of bars the close-through may lag the pivot. A gap that drifts sideways for a dozen bars before finally reversing has a pivot in it somewhere too, and it is not this formation.
There is no separate shape filter, and that is deliberate rather than an omission. A fair value gap is by definition a leg that moved faster than two-sided trade could occur, so two opposing gaps with a pivot between them and no test in between already describe the V. Adding a shape test on top of that would reject valid formations without catching anything the existing conditions miss.
The same fact explains the tool's behaviour: these are uncommon on high timeframes and get more frequent as you drop down, because the speed requirement is harder to satisfy the more time a candle covers.
The zone is the untraded air, not the intersection
The overlap of the two gaps is only the candidate band. What gets drawn is the part of it with no wick lying in it.
If a wick from the bars between the two gaps reaches into the candidate band, that part has been traded and is removed, and the wick's own extreme becomes the edge of the zone. A wick taking a third of the band leaves two thirds drawn. A wick clean through it leaves nothing, and no zone appears.
Only the bars strictly between the first gap completing and the candle that broke it can trim. The breaking candle transits the whole band by definition and the second gap's own candles are the displacement, so counting either would erase every zone.
The box still starts at the candle that formed the first gap, so it stays attached to its origin rather than floating in mid-chart at the wick that trimmed it, and it runs to the live candle the way a breaker or an inversion does. A minimum size in ticks applies after the trim, so a band cut down to almost nothing does not paint.
Polarity follows the newer gap. The most recent displacement is the one describing how the market is currently delivering, so a bullish gap broken downward produces a bearish zone, and the reverse for a bullish one.
Midpoint and labels
Each zone can carry its consequent encroachment — the midpoint of the drawn band, taken after the trim rather than from the raw overlap. A range has an equilibrium; a price delivery array has a consequent encroachment, and they are not the same object.
Names sit beside the box on its centre line, just past the right edge, so a name stays readable when its zone is only a few pixels tall and never crosses the midpoint line.
The two parent gaps can be shown faintly behind the zone. It is off by default: the trimmed band is the point of the tool, and drawing both parents puts back the clutter it exists to remove.
Invalidation
A zone is spent when a candle body closes clean beyond its far edge against its direction. On the default setting it is removed, the same rule this stack applies to any spent inventory. It can instead be faded and kept, which holds the record of where delivery already happened.
Live zones are capped per side, oldest removed first, so a long session cannot fill the chart.
The console
A small table, verdict first: whether there is support, resistance, both or nothing live. Under it, the count on each side, and a respected count.
Respected means price returned into the zone and has not closed through it. It is counted only across what is currently drawn, so the number always describes the boxes in front of you rather than a hidden history, and an invalidated zone leaves the count together with its box. A watching row shows how many untested gaps are still able to become a zone.
Every row carries its rule in the cell tooltip.
Alerts
Four. Bullish zone formed, bearish zone formed, and first touch on each side. The formation alerts fire on the close that completes the second gap; the touch alerts fire the first time price returns into a drawn zone.
Method and repainting
Everything is read from the chart timeframe. There are no higher-timeframe requests anywhere in the script, so there is no lookahead to configure wrongly and no future data to leak.
Every detection is gated to a confirmed bar close. The test call, the break, the second gap and the invalidation are all judged on closed candles, so nothing appears mid-bar and then withdraws.
One characteristic is inherent to pivots and worth stating plainly rather than leaving to be discovered: a swing is only confirmed once the bars to its right have printed. On the three-candle setting that is one bar, on five it is two. A zone therefore confirms a bar or two after the move that created it. That is lag, not repainting — nothing moves once drawn.
Zones and midpoint lines extend rightward to the current bar while they are live. That is the box tracking the present, not its history changing.
What it will not do
It places no entries, exits, stops or targets, and it does not size a position. It draws no bias, no trend and no projection.
It does not read structure beyond the pivots it uses, and it does not label market phases. Whether a drawn zone is worth trading is a judgement about context this script does not have — the session, the higher-timeframe draw, and what the day has already done.
A gap that gets tested draws nothing. Two opposing gaps overlapping without a pivot between them draw nothing. A candidate band that a wick has already run through draws nothing. Only the finished sequence produces a zone, so an empty chart through a slow session is the tool working rather than failing.
Settings
Pivot length; minimum parent gap in ticks; minimum zone size after the wick trim; maximum bars from the pivot to the close-through; maximum bars from the break to the opposing gap; the per-side cap on live zones; behaviour on invalidation, remove or fade and keep; the consequent encroachment midline; the parent gaps behind the zone; how far right the drawings extend past the live candle; the console; and label text size.
Disclaimer
This is a decision-support tool for discretionary ICT trading. It is not financial advice, and no market's past behaviour is indicative of future results. Indicatore

Stock Breakout Momentum StrategyDescription
A breakout entry alone isn't a system, it's the first third of one. What happens after the breakout fires is what usually decides whether the equity curve goes up or down: does every close beyond a lookback high get traded, or only the ones with real trend and participation behind them? Does a winning trade get room to develop, or does it get cut off by an exit window built for a losing trade? This strategy answers both questions directly: breakout entries are screened by a trend filter and a volume filter before they're taken, and once in a trade, a fixed ATR profit target works alongside a trailing stop and a materially longer time-based exit — instead of the time exit doing double duty as the only thing standing between a trade and an open-ended hold.
The Breakout Trigger, Now Screened by Trend and Volume
The core signal is unchanged from a classic breakout: a long triggers when a bar closes above the highest high of a lookback window (20 bars by default); a short triggers on a close below the lowest low. The signal only evaluates on barstate.isconfirmed, so it reacts to a bar's final, settled value rather than an intrabar tick, a non-repainting design where the order is submitted on the confirmed signal bar and fills at the next bar's open. What's new is what has to be true alongside that close: an optional trend filter requires price to be above a 50-period SMA for longs (below it for shorts), and an optional volume filter requires the breakout bar's volume to exceed 1.2× its 20-period average. Both are on by default and both can be switched off independently: turning them off reproduces the original unfiltered breakout-only version, which is a useful baseline to compare against.
Why Two Confirmation Filters Instead of One
A breakout on a stock trading below its own trend line, or on below-average volume, is a weaker signal than a breakout with the reverse conditions, a common cause of a low win rate is a system taking every technically-valid breakout regardless of context. The trend filter keeps the strategy from fighting its own directional bias; the volume filter is a basic conviction check against thin, low-participation moves that are more likely to be noise than the start of a real trend.
A Trailing Stop That Only Moves in Your Favor
Once in a position, the stop is recalculated every bar as entry ATR × a multiplier (2.0 by default) behind price, but it only ever ratchets in the trade's favor, a long's stop can rise as price rises but can't be pulled back down on a pullback, and a short's stop mirrors that in reverse.
An Explicit Profit Target, Not Just a Trailing Stop
Earlier versions of this approach relied on the trailing stop as the only way to close a trade in profit, which meant a short exit window could cut a winning trade off before the stop had room to ratchet up. This version adds a fixed ATR profit target (3.0× ATR by default, set once at entry and left in place; it doesn't trail the way the stop does) placed alongside the stop as a bracket order. Paired with the default 2.0× ATR stop, that's a built-in 1.5:1 reward-to-risk skew: the strategy doesn't need a high win rate to be net positive, it needs winners to average meaningfully more than losers, which is what the target is there to enforce. This can be turned off entirely if you'd rather rely on the trailing stop alone.
A Longer Time-Based Exit
Trades that haven't been stopped out or hit target within a set number of bars are closed as a housekeeping measure, a fixed exit window is there to purge trades that have stopped developing rather than to signal a directional call. That window is now 20 bars by default rather than a handful, giving the trailing stop and profit target actual room to do their jobs before the clock forces a decision. Whichever of the three exit conditions: stop, target, or time is met first is what closes the trade.
Position Sizing Tied to Equity, Not a Fixed Share Count
Instead of trading a static number of shares, the strategy calculates how many shares fit within a configurable percentage of current account equity (100% by default) divided by the current share price, floored to a whole share count with a floor of one. Sizing compounds with account equity rather than staying fixed at the starting balance. A dedicated "Allow Short Entries" toggle exists because not every account can short every stock; turn it off to backtest and trade long-only.
A Note on Shorting and Margin
Short positions on equities require margin, and margin requirements for shorting are not the same as the cash-equivalent share count this script computes for sizing; real brokers generally require posting more buying power to hold a short than to hold an equivalent long. Sizing at 100% of equity while shorting is enabled can produce trades a real margin account would reject or forcibly liquidate before the strategy's own exit logic gets to close them on its own terms. If you intend to trade this live with shorting on, size conservatively (well under 100%) and confirm your broker's actual margin requirements rather than relying on this script's sizing as a margin calculation.
Backtest Realism Settings
The strategy ships with commission modeled at 0.05% and 2 ticks of slippage baked into every fill, pyramiding disabled, and no same-bar order fills: defaults chosen so Strategy Tester numbers reflect something closer to live execution rather than an idealized fill.
Timeframes and Instruments
Built for equities, and tested across multiple timeframes and symbols with meaningfully different results depending on the instrument's underlying trend regime during the test window — a stock that trended cleanly produced a very different outcome than one that chopped sideways over the same period, even with identical settings. Because the exit logic is bar-count based, results will also vary by timeframe: retest breakoutLength, trendLength, atrMultiplier, profitTargetATRMult, and barsInTrade together whenever you change timeframe rather than assuming the defaults transfer.
What to Examine in Backtesting
Because of the built-in 1.5:1 reward-to-risk skew, a win rate meaningfully below 50% can still be net profitable: check the Strategy Tester's average win versus average loss alongside the raw win rate rather than judging on hit rate alone.
Watch trade count relative to your test window: a strategy that only fires a handful of times over several months (which the trend and volume filters will produce, by design) needs a longer test period or a broader set of symbols before a positive or negative result says much about a real edge versus a lucky or unlucky stretch. Also check the Margin Usage tab specifically if shorting is enabled, and compare max drawdown against total return, a strategy that gives back most of an open gain before ending marginally positive is a different risk profile than one that climbs more steadily, even if the final number looks the same.
Shared for educational purposes. This is not investment advice. Backtest results, including any shown in this listing's chart or comments, reflect a specific historical period and instrument and are not a representation of future performance. Trading involves substantial risk of loss and is not suitable for all investors. Strategia

Market Structure Flow Map [BOSWaves]Market Structure Flow Map - Strength-Scored Curved Ribbon Visualization of Break of Structure and Change of Character Events
Overview
Market Structure Flow Map is a market structure event visualization system that renders each Break of Structure and Change of Character as a curved three-layer ribbon connecting the broken swing pivot to the bar where the break occurred, where ribbon thickness, glow intensity, and arc curvature are driven by a composite strength score derived from the displacement beyond the broken level and the relative volume at the break bar rather than applying uniform visual treatment regardless of the conviction behind each structural event.
Instead of marking BOS and CHoCH events with simple horizontal lines or static labels, this system renders each structural break as a curved polyline ribbon that physically connects the origin swing point to the breakout bar, with the ribbon's visual weight scaling continuously from the configured minimum to maximum width based on how far price moved beyond the broken level and how significantly above average volume was at the moment of the break. Wider, brighter ribbons represent high-conviction structural breaks with strong displacement and volume evidence. Thinner, more subtle ribbons represent marginal breaks that barely cleared the structural level with below-average participation.
This creates a market structure visualization where the visual record of structural history is encoded with conviction information rather than presenting all breaks as visually equivalent events. The curved arc geometry provides an immediate spatial reading of the distance between the origin swing and the break bar, with longer arcs indicating structural breaks that developed over more bars. The three-layer glow, body, and core rendering gives each ribbon depth and visual prominence scaled to its structural significance. And the circular node markers at each broken swing pivot anchor the ribbon origins to the precise structural prices that were violated.
Price structure is therefore presented not just as a sequence of labeled events but as a visually weighted conviction map where the strongest structural breaks are immediately identifiable by their visual dominance over weaker ones.
Conceptual Framework
Market Structure Flow Map is founded on the principle that not all structural breaks carry equal significance, and that a visualization system which presents every BOS and CHoCH with identical visual weight fails to communicate the most important information available at the moment of each break: how convincingly price moved through the structural level and whether that move was supported by meaningful participation.
Traditional market structure tools mark every qualifying break with the same line, label, or zone regardless of whether the break was a decisive high-volume displacement or a marginal low-volume close that barely cleared the level. This framework replaces uniform visual treatment with strength-scaled ribbon geometry where every visual property of the ribbon reflects the composite conviction of the underlying structural event, creating a chart where the structural history reads as a visual conviction hierarchy rather than a flat sequence of identical events.
Three core principles guide the design:
Each structural break should be rendered as a physical curved connection between its origin swing and its break bar, preserving the spatial and temporal relationship between the structural level that was violated and the moment of violation rather than abstracting the event to a horizontal line.
Ribbon visual weight should scale continuously with a composite strength score that combines displacement magnitude and volume significance, ensuring that the chart's visual hierarchy reflects the structural conviction hierarchy rather than being independent of it.
BOS and CHoCH events should be visually distinguished not only through color but through the arc geometry, with the ribbon curvature and length encoding the temporal distance between the swing origin and the break completion.
This shifts market structure visualization from event marking into conviction-weighted structural flow mapping where the cumulative visual record encodes the relative significance of every structural event in the chart history.
Theoretical Foundation
The indicator combines pivot high and low detection for swing origin identification, configurable close or wick break confirmation for structural break detection, displacement-based and volume-ratio-based strength scoring with configurable weighting, structural state tracking for BOS versus CHoCH classification, three-layer curved polyline ribbon construction with strength-scaled width and distance-adaptive arc height, and circular node markers at broken swing pivot prices.
Displacement strength is calculated as the distance from the broken level to the break bar's source price, normalized against an ATR multiple and capped at the configured maximum. Volume strength is calculated as the excess of the break bar's volume above average relative to the configured maximum ratio, with below-average volume bars receiving zero volume strength. These two components are combined using the configured dispWeight and volWeight parameters, normalized by their sum so the total always produces a 0-1 strength score regardless of the weight distribution chosen. The arc height scales with both ATR and the temporal distance between the swing origin and break bar, so ribbons connecting distant origin-break pairs curve more dramatically than ribbons connecting adjacent ones.
Four internal systems operate in tandem:
Swing Detection and State Engine : Identifies confirmed pivot highs and lows using the configurable lookback, tracks the most recent unbroken high and low with their bar indices and prices, classifies each qualifying break as BOS or CHoCH based on the current structural state, and updates the structural state on each confirmed break.
Strength Scoring System : Calculates displacement from the broken level normalized against ATR, calculates volume ratio normalized against the configured maximum, combines both components with configurable weights, and maps the result to a 0-1 composite strength score that drives all ribbon visual properties.
Curved Ribbon Rendering Engine : Constructs three-point curved polyline paths from origin to arc midpoint to break bar for each of the three ribbon layers, applying strength-derived width to the body layer, additive width to the glow layer, and subtractive width to the core layer, with arc height scaling by both ATR and temporal distance.
Label and Node System : Places circular node markers at each broken pivot price to anchor ribbon origins visually, places directional event labels at each break bar offset by a small ATR fraction, and enforces maximum event count limits across all object arrays independently.
This design ensures every structural event produces a visually complete conviction-weighted representation while the object management system maintains a clean configurable historical event window.
How It Works
Market Structure Flow Map evaluates price through a sequence of structure-aware and strength-scored processes:
Pivot Detection : Confirmed swing highs and lows are identified using the configured left-right bar symmetry requirement, updating the tracked last high and last low prices and bar indices on each new confirmation.
Break Source Selection : Depending on the break mode setting, either the close price or the bar's high and low extremes are used as the source for testing structural breaks, allowing either confirmed closing breaks or intrabar wick-based breaks to qualify.
Break Detection : On each bar, the bullish break source is tested against the last unbroken high and the bearish break source is tested against the last unbroken low. A qualifying break requires the current bar to have crossed the level while the previous bar had not, and the level must not have been broken previously since its last registration.
Structural State Classification : Bullish breaks during a bearish structural state classify as bullish CHoCH. Bullish breaks during a neutral or bullish state classify as bullish BOS. The same logic applies in reverse for bearish breaks, with structural state updating to the new direction on each confirmed event.
Displacement Strength Calculation : The absolute distance between the break source price and the broken level price is divided by the product of ATR and the configured maximum displacement multiplier, clamped to a 0-1 range.
Volume Strength Calculation : The excess volume above average is normalized by the configured maximum ratio minus one, clamped to a 0-1 range. Bars with below-average volume receive a volume strength of zero.
Composite Strength Derivation : Displacement and volume strengths are combined using the configured weights normalized by their sum, producing a 0-1 composite score that drives all ribbon visual properties.
Ribbon Geometry Construction : Three chart points are derived at the origin swing bar, the temporal midpoint between origin and break, and the break bar. The midpoint arc height is calculated from ATR, the arc ATR multiplier, a distance factor derived from the bar span, and the composite strength. For bullish breaks the arc curves above both endpoints; for bearish breaks below.
Three-Layer Ribbon Drawing : The glow layer renders at the body width plus five with high transparency. The body layer renders at the strength-scaled width with low transparency. The core layer renders at the body width minus two with a near-white color at low transparency, providing depth and brightness.
Node and Label Placement : A circular node is placed at the origin swing price and bar. A directional event label is placed at the break bar offset by a small ATR fraction above for bullish breaks and below for bearish breaks.
Object Count Management : All five object arrays are independently trimmed to the maximum event count by removing the oldest entries, maintaining a clean rolling window of the most recent structural history.
Together, these elements form a continuously updating market structure visualization where every structural event is rendered as a spatially accurate, conviction-weighted curved ribbon that communicates both the structural significance and participation quality of each break.
Interpretation
Market Structure Flow Map should be interpreted as a conviction-weighted structural event history where ribbon visual weight communicates break significance:
Bullish BOS Ribbon (Cyan) : Curved ribbon arcing upward from a broken swing high to the break bar, indicating a continuation structural break in the direction of the prevailing bullish structural state. Ribbon width reflects break strength.
Bearish BOS Ribbon (Red) : Curved ribbon arcing downward from a broken swing low to the break bar, indicating a continuation structural break in the direction of the prevailing bearish structural state. Ribbon width reflects break strength.
Bullish CHoCH Ribbon (Green) : Curved ribbon arcing upward from a broken swing high during a bearish structural state, indicating a potential trend reversal where price has broken bullish structure against the prior downtrend.
Bearish CHoCH Ribbon (Amber) : Curved ribbon arcing downward from a broken swing low during a bullish structural state, indicating a potential trend reversal where price has broken bearish structure against the prior uptrend.
Ribbon Thickness : The primary strength indicator. Thick ribbons represent high composite strength with strong displacement and above-average volume. Thin ribbons represent weak breaks that barely cleared the structural level with low participation.
Ribbon Arc Height : Reflects both ATR-relative volatility and the temporal distance between the swing origin and break bar. Tall arcs indicate breaks that developed over many bars or occurred during high-volatility conditions. Flat arcs indicate quick breaks between adjacent swings.
Glow Layer : The wide transparent outer layer provides visual prominence that scales with ribbon width, making the strongest ribbons immediately identifiable across the full chart view.
Core Layer : The bright near-white inner layer provides a luminous center line that reinforces the direction and curvature of each ribbon while adding visual depth to the three-layer geometry.
Structure Nodes (Circles) : Circular markers at each ribbon origin anchor the structural event to its precise swing price, making it clear which pivot level was broken to produce each ribbon.
Event Labels : BOS and CHoCH text labels at each break bar identify the event type with color coding matching the ribbon, providing a text-based reference that complements the visual ribbon hierarchy.
Colored Candles : Optional bar coloring reflects the current structural state, coloring cyan during bullish structure and red during bearish structure regardless of individual bar direction.
Ribbon width hierarchy, arc geometry, color coding, and node placement collectively communicate more structural conviction information than text labels alone.
Signal Logic & Visual Cues
Market Structure Flow Map presents four distinct event types across two structural break categories:
Bullish BOS : Cyan ribbon connecting a broken swing high to the break bar during an established bullish structural state, confirming continuation of the prevailing upward structural sequence.
Bearish BOS : Red ribbon connecting a broken swing low to the break bar during an established bearish structural state, confirming continuation of the prevailing downward structural sequence.
Bullish CHoCH : Green ribbon connecting a broken swing high to the break bar during a bearish structural state, signaling a potential reversal of the prevailing downward structural sequence.
Bearish CHoCH : Amber ribbon connecting a broken swing low to the break bar during a bullish structural state, signaling a potential reversal of the prevailing upward structural sequence.
Both BOS and CHoCH events can be independently toggled, allowing the chart to focus exclusively on continuation signals, exclusively on reversal signals, or both simultaneously.
Alert generation covers bullish and bearish structural breaks for systematic structural monitoring workflows.
Strategy Integration
Market Structure Flow Map fits within momentum-validated market structure and conviction-weighted structural analysis approaches:
Ribbon Width Prioritization : Assign greater analytical weight to thick, wide ribbons representing high-strength breaks. Thin ribbons from marginal low-volume breaks carry reduced structural significance and warrant more caution before acting on the direction signal.
CHoCH Reversal Framework : Use green and amber CHoCH ribbons as primary reversal identification signals, treating their appearance as the first confirmation that structural direction may be shifting. Subsequent BOS ribbons in the new direction following a CHoCH provide continuation confirmation.
BOS Continuation Framework : Use cyan and red BOS ribbons as trend continuation evidence within established structural regimes, with wider BOS ribbons providing stronger confirmation of sustained directional momentum.
Arc Length Context : Monitor ribbon arc lengths as a temporal context indicator. Short low arcs between adjacent swings indicate rapid structural progression. Tall arcs spanning many bars indicate structural breaks that required extended time to develop, which may reflect different momentum characteristics than immediate breaks.
Ribbon Density Assessment : The density and direction consistency of recent ribbons provides a visual structural momentum reading. A sequence of uniformly wide same-direction ribbons indicates sustained structural conviction. A mix of widths and directions indicates contested structure without clear dominance.
Multi-Timeframe Structure Hierarchy : Apply higher-timeframe structural state as directional bias context, using lower-timeframe BOS ribbons to time continuation entries within the structural direction established on the higher timeframe.
Technical Implementation Details
Structure Detection : Pivot high and low confirmation with configurable lookback and close or wick break mode selection
Strength Scoring : ATR-normalized displacement combined with SMA-normalized volume excess using configurable weights summing to a 0-1 composite score
Ribbon Geometry : Three-point curved polyline construction with distance-adaptive arc height scaling and strength-proportional line width across three layers
Classification Logic : Structural state tracking for BOS versus CHoCH identification with independent visibility toggles per event type
Object Management : Five independent arrays with configurable maximum event count enforced by oldest-first removal
Candle Coloring : Structural state-driven bar color applied to body, wick, and border independently
Performance Profile : Real-time execution on each confirmed bar with polyline and label objects created at event time and managed through independent array trimming
Optimal Application Parameters
Timeframe Guidance:
1 - 5 min : Intraday structural flow mapping for scalping with shorter swing length for faster structural event detection on smaller swings
15 - 60 min : Session-level structural analysis with balanced swing length and moderate displacement and volume thresholds for meaningful event density across typical session structure
4H - Daily : Swing-level market structure visualization with longer swing detection for broader structural events that reflect significant trend-level breaks
Suggested Baseline Configuration:
Swing Length : 8
Break Confirmation : Close
Volume Average : 20
Displacement Weight : 0.6
Volume Weight : 0.4
Ribbon Arc (ATR×) : 0.7
Maximum Events : 35
Show BOS : Enabled
Show CHoCH : Enabled
Show Structure Nodes : Enabled
Color Candles : Disabled
These suggested parameters should be used as a baseline; their effectiveness depends on the instrument's swing frequency, typical displacement characteristics, and preferred structural event density, so fine-tuning is expected for optimal performance.
Parameter Calibration Notes
Use the following adjustments to refine behavior without altering the core logic:
Too many structural events firing : Increase Swing Length to demand more structurally significant pivot confirmation, reducing the frequency of detected breaks, or switch Break Confirmation to Close to filter out wick-based marginal breaks.
Structural events too infrequent : Decrease Swing Length toward 2 for more sensitive pivot detection, or switch to Wick mode to capture structural breaks that close below the level but print a wick through it.
All ribbons appearing similar width : Adjust Max Displacement ATR and Max Volume Ratio to calibrate the scoring thresholds to the instrument's typical break characteristics. If most breaks exceed the maximum thresholds the scoring range collapses and all ribbons appear near maximum width.
Volume scoring not contributing : Decrease Max Volume Ratio to make above-average volume easier to achieve on the scoring scale, or increase Volume Weight to give volume a larger proportion of the composite score.
Ribbons too flat or too curved : Adjust Ribbon Arc ATR to scale the arc height. Lower values produce flatter, more linear ribbons. Higher values produce more pronounced curves, particularly on breaks that span many bars.
Too many ribbons cluttering the chart : Reduce Maximum Events to limit the historical ribbon count, or reduce Swing Length to produce more frequent events that each span shorter temporal distances, resulting in smaller arcs and less visual overlap.
Adjustments should be incremental and evaluated across multiple session types rather than isolated market conditions.
Performance Characteristics
High Effectiveness:
Trending markets with clear directional structural sequences where BOS ribbons accumulate in the trend direction and CHoCH ribbons mark definitive reversal points with distinct visual separation from the preceding BOS sequence
Instruments with consistent volume participation where the volume scoring component produces meaningful differentiation between high-conviction and low-conviction breaks rather than uniform low scores
Market structure-based trading approaches where the visual conviction hierarchy of ribbon widths provides immediate differentiation between structural breaks worth acting on and marginal breaks warranting caution
Multi-timeframe structural analysis where the ribbon history provides a visual structural narrative that communicates trend progression, reversal identification, and conviction levels simultaneously
Reduced Effectiveness:
Choppy, range-bound markets where frequent alternating BOS and CHoCH events in both directions produce a dense mixed-color ribbon cluster without a clear structural narrative
Low-liquidity instruments where volume is consistently below average, suppressing volume strength scores and causing most ribbons to render at or near minimum width regardless of structural significance
Markets with very large or small typical ATR ranges where the arc height calculations produce ribbons that are either too flat to read or that arc so dramatically they dominate the visible chart area
Extremely fast-moving markets where structural breaks occur on single large bars that span large price distances, producing short temporal ribbons that offer limited visual differentiation from one another
Consolidation environments where price oscillates between two nearby swing levels without establishing clear directional structural progression, generating frequent opposing CHoCH events without the sustained BOS sequences that define clear structural trends
Integration Guidelines
Confluence : Combine with BOSWaves volume flow tools, order flow analysis, or momentum indicators to validate high-strength CHoCH and BOS ribbons with broader analytical context before committing to structural direction trades
Width Hierarchy Respect : Build a ribbon width filter into your analysis workflow. Thin ribbons from marginal breaks should be treated as weak structural evidence requiring additional confirmation. Thick ribbons from high-displacement high-volume breaks warrant greater directional confidence.
CHoCH Sequencing : A single CHoCH ribbon is not sufficient confirmation of a structural reversal in isolation. Wait for a subsequent BOS ribbon in the new direction to confirm that structural momentum has genuinely shifted before treating the CHoCH as a completed reversal.
Arc Geometry Reading : Use ribbon arc height as a secondary strength indicator. Tall arcs on strong ribbons indicate breaks that developed over many bars with sustained momentum. Short arcs on strong ribbons indicate rapid decisive breaks that required minimal time to complete.
State Discipline : Maintain structural bias aligned with the current state established by the most recent CHoCH until a new CHoCH in the opposing direction confirms a structural shift. Individual BOS ribbons within an established trend do not alter the structural regime and should be interpreted as continuation rather than reversal evidence.
Disclaimer
Market Structure Flow Map is a professional-grade market structure visualization and conviction-weighted structural event analysis tool. It uses pivot-based break detection with composite displacement and volume strength scoring but does not predict future price movements. Results depend on market conditions, instrument structural characteristics, parameter selection, and disciplined execution. BOSWaves recommends deploying this indicator within a broader analytical framework that incorporates order flow context, volume analysis, and comprehensive risk management. Indicatore

Trend Survival MatrixMost trend tools tell you which way the trend is going, but not how late you are in it. The Trend Survival Matrix answers that directly. It tracks the live trend across three timescales (short, medium, and long EMA regimes) and measures each one's age — the number of bars since it last flipped. Then, from every completed trend in the chart's history, it builds an empirical run-length distribution and estimates a conditional survival probability: the odds the current trend lasts at least 5, 10, or 20 more bars given how long it has already run. Crucially, those odds are conditioned on the volatility regime each historical run was born in (low / normal / high ATR-percentile buckets), so a long, calm trend isn't judged against runs that formed in chaotic conditions.
The panel reads left to right: direction, current age, the typical (median) run length for that regime, survival odds at each horizon, and a maturity state — FRESH, HEALTHY, MATURING, EXTENDED, or EXHAUSTION — driven by an overextension z-score (how many standard deviations the current age sits above the historical mean). On the chart, a ribbon between the primary EMA pair tints by direction and fades as survival decays, so a durable trend looks solid while a fragile, overextended one visibly thins out. Markers flag new trends, and a once-per-run label warns when survival drops below your threshold — useful for deciding whether to add, tighten stops, or prepare to fade.
Everything is empirical and inspectable — the survival figures come straight from the instrument's own history, not a black box or preset numbers. The engine is fully non-repainting (state advances only on confirmed bars, with no higher-timeframe requests), so the readings stay stable when you switch chart timeframes. Where there aren't enough historical samples to condition on, the panel honestly reports LOW DATA and a confidence flag rather than showing a made-up probability. Works on any symbol and timeframe; tune the EMA lengths, horizons, and volatility buckets to your market. Indicatore

Range Budget - Anchored Extension and Daily Range Exhaustion============================================================
DESCRIPTION
============================================================
Range Budget measures how much of a typical daily range has
already been delivered, and how far the current directional
leg has travelled, so that a level can be assessed on distance
as well as location.
The problem it addresses is a common one in level-based
trading. A level is identified in advance, price arrives, and
the setup is taken without accounting for how far price
travelled to get there. A level reached after a move that has
already covered a full day's range is a materially different
proposition from the same level reached after a quiet drift,
even though the level itself is identical. This script
quantifies that difference.
WHAT IT CALCULATES
Anchor and extension
The anchor is a chosen session open: the CME open at 18:00,
midnight, 08:30, or the regular session open at 09:30, all in
the selected timezone. The anchor is detected by tracking
minutes elapsed since the anchor time with wraparound across
midnight; a decrease in that value marks a new anchor period.
An optional gap check re-anchors at the Sunday reopen rather
than carrying the prior Friday value through the weekend.
Extension is the signed distance in points from the anchor
open to the current close. Session high and session low are
tracked from the anchor forward.
Leg travel
Up leg is the distance from the session low to the current
close. Down leg is the distance from the session high to the
current close. These are reported separately from extension
because extension understates a move that opened, reversed,
and then ran. A session that opens, falls forty points and
rallies eighty shows an extension of plus forty while the leg
being entered is eighty points old. The two readings answer
different questions: extension describes location relative to
the open, leg travel describes how much of the current move
has already occurred.
Daily range statistic
The denominator is a trailing statistic of daily high minus
low, taken from completed daily bars only. A one-bar offset is
applied inside the higher timeframe request so the forming day
is excluded from its own benchmark. The statistic is constant
intraday by construction.
Three methods are available. The default is the median rather
than the mean. Daily range distributions are right skewed and
a single outlier session, or a holiday half-day, shifts a mean
for the entire length of the window while barely moving a
median. Mean and exponential options are provided for users
who prefer them.
Range basis can be set to the full exchange day or to the
regular session only, which changes both the statistic and the
current day measurement consistently.
Budget and projections
Budget is today's realised daily range expressed as a
percentage of the denominator, displayed as a ten segment
gauge. Projections are drawn at the day low plus the
denominator and the day high minus the denominator. Room
reports the distance in points from current price to each
projection. This formulation is used in preference to
projecting symmetrically from the open because it accounts for
what the session has already delivered rather than assuming
the open sits at the centre of the eventual range.
Regime ratio
A rolling median range over a short window is divided by the
same statistic over the long window. Volatility expands far
faster than a fixed lookback adapts, so on the first day of a
changed environment the long window is still describing the
previous one. The ratio detects that condition immediately
rather than after the window has turned over. Values above the
expansion threshold indicate the short window is the more
representative reading.
State
The state row combines budget and regime. Budget beyond one
hundred percent is ambiguous in isolation: it can mean the day
is finished, or it can mean the denominator is stale. When
budget exceeds the exhaustion threshold and the regime ratio
is simultaneously elevated, the state reports expansion rather
than exhaustion, because the appropriate reading in that case
is a trending environment rather than a completed one.
Pullback levels
Optional retracement levels are drawn at configurable
percentages of the leg delivered since the anchor, measured
back from the extreme in the direction of travel.
WHAT IT DRAWS
A vertical line marking the anchor boundary, with a
configurable number of prior boundaries retained as session
separators.
A horizontal line at the anchor open, plus dotted session high
and low lines, each labelled with price and points from the
open. These are drawn for the current anchor period only and
are rebuilt at each new anchor, so historical periods do not
accumulate on the chart.
Three compact daily candles to the right of the last bar
showing the forming day and the two prior days. They are drawn
at true price levels, so they also serve as visual references
for the previous day high, low and close. The forming day
carries a dashed border and updates live.
Optional projection and retracement lines, both off by
default.
A panel reporting anchor open, extension, session range, up
and down leg with their share of the denominator, the budget
gauge, room to each projection, the denominator with its
method and window stated, the regime ratio, and the state.
Leg cells are colour graded against the exhaustion thresholds.
SETTINGS NOTES
Three separate lookback windows are used and they drive
different things. The slow window drives the denominator, the
gauge, the projections and room. The fast window drives only
the regime ratio. The context window drives only the minimum,
maximum and quartile rows, where responsiveness does not
matter.
A manual denominator override is provided. It exists for the
first session after a clear regime break, when the operator
knows the environment has changed and the window has not yet
caught up.
READING IT
The leg readings graded against the denominator are the
primary output. A leg at or beyond one hundred percent means a
full typical day's range has been delivered in one direction.
Room reports whether a target has space remaining even if the
directional read is correct.
The denominator is a range statistic, not a displacement
statistic. It describes the height of the envelope a session
typically builds, not how far price travels within it, and net
close to close movement is normally much smaller. A setup
requiring a large fraction of the typical envelope in a single
directional leg is an expansion day proposition rather than a
normal day proposition.
LIMITATIONS
This is a context readout. It produces no entries, no
directional bias and no filtering output, and it is not
intended to confirm or reject a setup on its own.
Leg readings measure distance, not recency or velocity. A leg
reset occurs whenever a new session extreme is made, so a leg
built slowly overnight and a leg built rapidly in the last
half hour produce identical readings.
No time of day weighting is applied. A given percentage of
range consumed early in a session and the same percentage late
in a session are not equivalent situations, and the script
does not currently distinguish them.
The denominator lags a genuine volatility regime change by at
least one session. The regime ratio shortens that lag but does
not eliminate it.
Compact daily candles are drawn at true price levels, so on a
strongly zoomed intraday chart the prior days may fall outside
the visible price scale. Indicatore

Indicatore

TradeGuard-v0.5TradeGuard-v0.5 | Complete Options Trading System
⚠️ This is the only active version. All previous versions (v0.1, v0.2, v0.3, TradeGuard Full, TradeFlow Full System) are retired and no longer maintained. Remove old versions from your chart and add this one.
What is TradeGuard?
Built from scratch after losing money with a 72.5% win rate. The problem wasn't entries — it was exits and holding losers too long. TradeGuard is designed around one core idea: stop the trader from destroying their own edge. It reads market structure, institutional footprints and multi-timeframe alignment automatically so you can focus on executing, not analysing.
CORE SIGNALS
Trend Detection — fully automatic
Triple EMA system 13/48/200 in yellow/purple/red. Automatically reads UPTREND, DOWNTREND or CHOPPY. No manual input required.
BUY CALL / BUY PUT
Six entry types fire automatically — 13 EMA pullback, EMA reclaim, PMH/PML retest, PDH/PDL retest, ORB retest, liquidity sweep. All require trend + volume confirmation. Labels fire once on state change only — not every bar.
CUT CALL / CUT PUT
Fires the moment the EMA breaks. 0DTE mode uses 3-bar no-bounce rule — doesn't wait for candle close because theta doesn't wait. Weekly mode waits for candle close confirmation.
CONFLUENCE SCORING 0-10
Counts how many of 10 factors align before firing. 7+ = ★★★ label on chart, size up. 5-6 = ★★, normal size. Below 5 = silent. Stops you from entering weak setups that only have 2-3 things going for them.
LIQUIDITY SWEEP DETECTION
SW diamond fires when stops have been taken and institutions have entered. Four sweep types: PDH/PDL sweeps, PWH/PWL sweeps, EMA sweeps, equal highs/lows. The reversal after a sweep is sharper because weak hands are cleared out. Combining a sweep with 7/10 confluence is the highest probability setup in the system.
ORDER FLOW APPROXIMATION
Four signals reading the institutional footprint on price and volume. No Level 2 or DOM required.
🐟 Big Fish — Large institution filled an order here. High volume, tiny range = someone absorbed all the flow without moving price. That's a large fill.
W Wall — Big money blocking the move. Price keeps hitting same level with above average volume but cannot break through. Wall below = hidden buyer = CALL bias. Wall above = hidden seller = PUT bias.
Hidden — Iceberg order sitting at this level. Same price tested multiple times with volume, each time bouncing back. The order never runs out because it keeps refreshing.
F Flip — Big money changed direction. High volume reversal candle after a trending move. Institutional size switched sides.
The full sequence: Hidden → Wall → Big Fish at same level = institution finished accumulating or distributing. Label fires: "CALL SETUP BUILDING" or "PUT SETUP BUILDING". Add a sweep and 7/10 confluence = highest probability trade in the system.
REGIME QUALITY SCORE 0-6
Structural score before any entry fires: 2m trend, 5m aligned, 15m aligned, VWAP position, no squeeze, clean session time. LOW regime blocks all entries and tells you exactly what's missing.
KEY LEVELS — all automatic
PMH/PML — premarket high/low (orange)
PDH/PDL — previous day high/low (yellow)
PWH/PWL — previous week high/low (bright yellow, thick) ← most important for weekly options
ORB — opening range with 50%, 1.5x, 2x extensions (aqua)
Intraday fibonacci 0.5 and 0.618
Today's high/low
MTF Key Levels
Previous day/week/month OHLC + equilibrium levels (pdEQ, pwEQ)
Current week/month/year high/low
Y-VWAP (red, thick) — yearly institutional bias line
GEX Proxy Levels
~Flip — gamma flip proxy. Above = pinned/mean-reverting. Below = volatile/trending
~CW / ~PW — nearest $5 round number call wall / put wall proxy
Orange background when negative gamma (trending environment)
ASIA + LONDON SESSION BIAS (SPY/QQQ/indices only)
Shaded backgrounds for each session. Bias label at 9:30am open. London sweep detection — when London sweeps Asia lows and reverses, that's the strongest call setup of the session.
CHART PATTERNS
Bull flag, bear flag breakouts detected and shown in Pattern table row.
STATUS TABLE — 26 rows
Updates live every bar. Trend, EMA, VWAP, Volume, Squeeze, PMH/PML, PDH/PDL, Session, Order Flow, ORB, Pattern, 5m trend, 15m trend, Confluence, Signal, Regime, Gamma, Flip, Asia bias, London bias, US bias, Swing bias, Y-VWAP, Expiry suggestion, Stalled.
ALERTS
40+ alerts including: BUY CALL/PUT, CUT CALL/PUT, HIGH/GOOD confluence, all sweep types, all order flow signals, Y-VWAP cross, PWH/PWL break, MTF level touches, pattern breakouts.
ONE TOGGLE ONLY — 0DTE or Weekly mode. Everything else is automatic.
Best on 2-minute chart for entries. Table provides full higher timeframe context.
~ prefix on GEX labels = structural approximations, not live options chain data. Indicatore

Macro Risk Sentinel🛡️ Macro Risk Sentinel: Smart Crash Detector & Trend Filter
The Macro Risk Sentinel is a powerful risk management tool built to protect your trading from sudden market dumps. Instead of relying on lagging price indicators, this script looks under the hood of the market—tracking hidden credit health and volatility data—to spot panic before it destroys your chart.
Whether you trade manually or run automated algorithmic swing trading strategies, the Sentinel acts as a safety switch.
⚙️ How It Works: The "Smart Recovery" System
Most crash indicators lock you out of the market for way too long, making you miss the most profitable part of the rebound. We fixed this with our built-in Smart Recovery logic.
🔴 Red Zone (Lockdown): Real market panic detected. The indicator turns your chart background red, signaling a strict "Risk-Off" state. It's time to cut longs or pause your trading bots.
🟡 Yellow Zone (Caution): Early warning signs. The market is getting choppy. This is your cue to tighten stop-losses and reduce position sizes.
🚀 Smart Unlock: The game-changer. While in a lockdown, the Sentinel constantly monitors the market in the background. As soon as volatility drops and a healthy price trend begins, it fires a "Smart Unlock" signal. You get the green light to jump back in exactly as the new uptrend starts, without waiting for a blind timer to run out.
✨ Key Features
Under-the-Hood Data: Driven by real market stress metrics (Volatility and High-Yield Credit ratios), not just simple moving averages.
100% Backtest Safe (No Repaint): Built with strict causal logic and zero lookahead bias. What you see on historical bars is exactly what would have printed live, making it perfectly safe to build automated strategies around.
Clean Live Dashboard: A simple, non-intrusive panel on your chart shows the current market state, the recovery conditions, and the lockdown countdown at a glance.
Visual Clarity: Intuitive background colorings and clear chart markers (Crash ⛔, Smart Recovery 🚀) so you never have to second-guess the market environment.
Fully Customizable: Easily tweak the trigger thresholds and lockdown duration to match your specific trading style and risk tolerance.
🎯 Perfect For:
Algorithmic traders who need a "kill switch" for their automated systems.
Swing traders tired of getting caught and holding bags during sudden market crashes.
Systematic traders looking to automate their risk-on/risk-off rules based on hard data. Indicatore

Trend Dashboard - Direction and StrengthTrend Dashboard - Direction and Strength.
A single compact table that reads eleven trend, momentum, volatility, structure and volume-flow indicators on up to four timeframes at once. The directional readings are condensed into a score and a categorical verdict for each timeframe, while trend strength is reported separately by the ADX row and never enters the sum, so direction and strength stay two distinct answers. Built for top-down traders who want the confluence check they normally perform by switching charts to happen in one place, on the chart they are already trading.
How it works:
Every indicator for a given timeframe is computed inside one function and delivered by a single request.security call per timeframe, with lookahead disabled, so the table never reads data that was not available at the time of the bar. The four timeframe slots are user-assigned and default to daily, 4 hours, 1 hour and 5 minutes. Column headers are derived from the assigned timeframe itself, so reassigning a slot relabels the column. Market structure is delivered by a second request per timeframe: it tracks confirmed swing highs and lows over a configurable pivot window, registers the direction of the last break, and counts how many continuation breaks have followed the last change of character.
The table is rebuilt on the last bar only and cells are wiped before each refill, so toggling a timeframe off cannot leave stale values in a column that has shifted. Rows are ordered by the weight of the information they carry: structural context first, then macro regime, then medium-term structure, momentum, strength and the local price position, followed by the three context rows and the score and verdict at the bottom. A marker column carries a coloured dot for rows that must not be read as ordinary trend votes: orange for mandatory context that stays outside the score, white for indicators running on simplified parameters or on an approximation, blue for market structure. The script also detects whether the symbol reports volume. On symbols with no volume feed, cumulative volume delta and OBV divergence print a dash instead of a neutral reading, and the volume delta vote is dropped from the score, which lowers the maximum from eight to seven while the verdict thresholds stay absolute.
What it calculates:
- Market structure — direction of the last swing break, with a phase suffix (C, C+1, C+2 and higher) counting continuation breaks since the last change of character.
- EMA mid/slow — macro regime, the golden and death cross relation.
- EMA fast/mid — medium-term trend structure.
- SuperTrend — ATR trailing direction, computed from a configurable ATR length and factor.
- Ichimoku Kumo — price against the cloud built from the 9, 26 and 52 bar ranges.
- MACD — bullish only when the MACD line leads the signal line and the histogram agrees.
- RSI — directional reading around the midline, with the raw value shown in the cell.
- CVD — cumulative volume delta approximated from the position of the close inside the bar range, read as the agreement between flow slope and price slope.
- Price vs fast EMA — the local position of price, the most sensitive of the trend votes.
- ADX and DMI — trend strength with the raw ADX value shown in the cell, and direction from the DMI pair once the threshold is met.
- OBV divergence — price extreme of the window not confirmed by cumulative volume.
- RSI divergence — price extreme of the window not confirmed by momentum.
- Score — the sum of the eight directional votes per timeframe, shown against the maximum available on the symbol.
- Verdict — STRONG BULL, BULL, MIXED, BEAR or STRONG BEAR, derived from absolute score thresholds.
Key features:
- Four independently assignable timeframe slots, each with its own visibility toggle. Hidden columns shift the remaining ones left and are excluded from the alignment alerts.
- Column headers derived from the assigned timeframe, formatted as 1D, 4H, 1H, 5M rather than fixed labels.
- Separation of directional votes from context. Market structure, ADX and the two divergence rows are displayed but never summed into the score, so trend strength and reversal warnings are not confused with direction.
- Automatic handling of symbols without volume: the affected rows print a dash and the score maximum drops to seven, with verdict thresholds left absolute.
- Per-row tooltips that state what the indicator measures, how to read the three states, its role inside the system and its known failure modes.
- Configurable parameters for every indicator: EMA lengths, RSI length and thresholds, MACD triplet, ADX length and threshold, SuperTrend ATR and factor, CVD lookback, OBV and RSI divergence windows, and the market structure pivot window with a choice between candle close and wick confirmation.
- Ten alert conditions: a bullish and a bearish verdict transition for each of the four timeframes, plus full bullish and bearish alignment across all visible timeframes.
- Table position and text size selectable, with all signal and table colours exposed as colour inputs.
Who it's for:
Trend followers, swing traders and intraday traders who work top-down and want the higher timeframe bias, the execution frame and the entry frame visible at the same time. It suits price-action and SMC or ICT workflows that treat break of structure and change of character as the primary context, and momentum-based approaches that need a strength filter before acting on a directional signal. The outcome is one table that answers whether a trend exists, which way it points on each timeframe, and where the timeframes disagree, without stacking a dozen overlays on the chart. Indicatore

Consolidation Ranges [ITA]🟠 OVERVIEW
Consolidation Ranges finds the places where price stopped trending and went sideways, draws the range while it forms, marks the bar that closes outside it, and then keeps watching to see whether that breakout actually held.
Finding a sideways range is the easy half. Every tool in this category draws the box and marks the breakout, and then stops, which is where the trader's real problem starts. The most common complaint about trading ranges is that the breakout fails and price comes straight back in, and almost nothing measures how often that happens.
So this one waits. After a breakout it gives price a set number of bars to stay outside. Close back inside within that window and the breakout is marked Failed. Stay out and it is marked Held. The running count of both sits in the corner.
🟠 CONCEPTS
* Consolidation - A stretch of bars whose full high to low span stays inside a chosen multiple of ATR. Measuring the range in ATR rather than in points means the same setting behaves the same way on a quiet symbol and a volatile one.
* Range Widening - While price stays inside, the box grows to contain each new bar, but only while the result is still narrow enough to count as a range. Without that limit a slow drift never breaks out, it just drags the box along with it.
* Breakout - The first close outside the box. The close matters rather than the wick, because a wick outside a range is the thing that most often reverses.
* Confirmation Window - The number of bars a breakout is given to prove itself.
* Held and Failed - What actually happened. Held means price stayed outside for the whole window. Failed means it closed back inside the range it had just left.
🟠 FEATURES
🔹 Range width measured in ATR, so one setting works across symbols and timeframes rather than needing to be retuned for each
🔹 The box builds live as the range develops and locks on the bar that breaks it
🔹 Breakouts marked in both directions at the price where the close happened
🔹 Every breakout followed to an outcome and labelled Held or Failed
🔹 A running count of held against failed breakouts, with the rate, for the symbol and timeframe on screen
🔹 Separate alerts for a break up, a break down, a failed breakout and a held breakout
🔹 If the settings are strict enough that nothing is found, the chart says so and names the two inputs to change, rather than leaving you looking at an empty chart unable to tell a quiet symbol from a bad setting
🟠 HOW TO USE
Set Range Length first. It decides how significant a consolidation has to be before it is drawn at all. Twenty bars is a reasonable starting point on any timeframe. Raise it for fewer and larger ranges.
Max Width is the second control. If nothing is being found on a volatile symbol, raise it. If the whole chart is boxes, lower it.
Then read the count in the corner before anything else. It is telling you whether breakouts on this symbol and timeframe have been worth taking. A symbol where most breakouts failed is not a symbol to trade breakouts on, and that is worth knowing before the next one rather than after it.
Bars To Confirm decides how patient the measurement is. A short window counts quick reversals as failures. A longer one only counts a breakout as failed if price genuinely came back.
🟠 CONCLUSION
Drawing the range is the part every tool does. The part that decides whether the range was worth trading is what happened after the break, and that is what this one records. Indicatore

Global Net Liquidity - (Giovanni Fork)Hello traders. This plots the combined balance sheets of the Fed, ECB, BoJ, PBoC and Bank of England, converted to dollars, with the US Treasury General Account and the Fed's reverse repo facility subtracted.
There are already a lot of global liquidity scripts on here, so I want to be clear about what this one does differently rather than just adding another overlay to the pile. Three things.
First, this is a net measure.
Gross central bank assets tell you how much money has been created. They do not tell you how much of it is actually available, because some of it gets created and then taken straight back out of circulation. Money sitting in the Treasury's account at the Fed is not in the system. Nor is cash parked overnight in the reverse repo facility. Subtracting those gives you what is genuinely out there, and that is what net means here. At the time of writing it is 0.97tn in the TGA coming off a gross of 22.37tn.
It is also worth saying that this is built from central bank balance sheets rather than M2. Those are related but they are not the same measure, so if you are comparing this against something else, check which one you are looking at.
Units are worth paying attention to when you combine feeds like this. The underlying sources do not agree with each other: FRED publishes the Fed balance sheet in millions and the reverse repo facility in billions, and the China balance sheet is reported in hundred millions of yuan. TradingView appears to normalise all of them to absolute units before serving them, which is why every scale factor in this script is 1.
I would still rather you checked than took my word for it. Every series has its own visible scale factor and the table prints each component in USD trillions, so you can compare the numbers against what you know the Fed and the ECB are actually running. If a row looks wrong by orders of magnitude, that series' scale input is wrong and you can correct it in the settings without touching the code.
Second, China is measured properly.
The PBoC balance sheet is a poor gauge of Chinese liquidity and most aggregates include it anyway. Its growth up to 2014 was foreign exchange accumulation rather than stimulus, so the series has meant different things in different decades. More importantly, the PBoC's main easing tool is the reserve requirement ratio, and that is balance sheet neutral. Cutting the RRR reclassifies required reserves as excess reserves, releasing roughly 1 trillion yuan per 50bp, while total assets do not move at all. The biggest thing the PBoC does is invisible to a balance sheet aggregate.
The default here subtracts required reserves, estimated as the reserve ratio applied to M2 as a deposit proxy, so an RRR cut registers as the easing it actually is. You can switch back to the plain balance sheet or to the commercial bank balance sheet in the settings. It is an approximation because China's RRR is tiered across large, small and rural banks and the headline rate only covers the large ones, but it responds to the right events.
Third, and this is the part I think adds most, the currency effect is separated out.
Every aggregate that converts foreign balance sheets at spot has dollar moves baked into it. A stronger dollar shrinks the line even when no central bank has done anything, and that gets reported as tightening.
The purple line is the same aggregate chain linked at constant currency. Each period's balance sheet change is converted at that period's own opening rate and accumulated, so it shows what the balance sheets did without the currency. The shaded gap between the two lines is the currency effect, and the table gives it as a number. Since January 2016 it is 1.56tn, meaning that much of the apparent decline in global liquidity was dollar strength rather than central bank action.
The BoJ is the clearest example. Its assets have grown in yen over recent years while its reported dollar contribution has fallen sharply. A gross liquidity chart reads that as the BoJ tightening. It didn't tighten, the yen moved.
A few things to be aware of before you use it.
The chain start date is January 2016 by default and it matters. The constant currency line is accumulated rather than measured, so it seeds at that date and the two lines are identical there by construction. The currency figure is always cumulative since the start date, so 1.56tn means since January 2016, not in absolute terms. Set the date later if you find a component with no data at the start.
The TGA and RRP are US specific drains applied to a global gross, which is slightly inconsistent. Everybody does it, few say so, so I am saying so.
The underlying data updates weekly at best and the PBoC monthly, so use this on daily or higher. Intraday just repeats the last print.
I built this because I wanted to know how much of the last three years of liquidity contraction was real and how much was the dollar. If it is useful to you, say so, and if you think I have got something wrong let me know. Indicatore

Delta Trend Delta Trend is a momentum and directional-trend indicator designed to measure the relative movement of price between the open and close of each candle. It converts the percentage change within each candle into a smoothed Delta Line, allowing traders to identify whether short-term price momentum is strengthening or weakening.
The indicator uses the relationship between the candle's Open and Close to calculate its raw directional movement. This value is then smoothed using a Weighted Moving Average (WMA) and multiplied by an adjustable Delta Adjust factor. The resulting Delta value provides a normalized representation of short-term price momentum.
How the Delta is calculated
The raw calculation is:
(Close − Open) / (Close + Open)
This measures the directional movement of the current candle relative to its overall price level.
The raw value is then smoothed using the selected Delta Smooth period and multiplied by the Delta Adjust setting:
Delta = WMA(Raw, Smooth) × 100 × Adjust
A higher Delta indicates stronger positive price momentum, while a negative Delta indicates bearish price momentum.
Delta Trend
The indicator compares the current Delta value with the previous Delta value.
Rising Delta → momentum is increasing or strengthening.
Falling Delta → momentum is decreasing or weakening.
The Delta Line is displayed in:
White when Delta is rising.
Red when Delta is falling.
This allows the trader to see changes in momentum visually without relying solely on whether price itself is moving up or down.
Zero Line and Thresholds
The indicator includes several reference levels:
0 — the primary bullish/bearish dividing line.
0.3 — an early positive-momentum threshold.
3 — a stronger positive-momentum threshold.
The area behind the indicator is shaded blue whenever Delta is zero or above, providing a quick visual indication that momentum is on the positive side of the zero line.
Delta Table
A table in the upper-right corner displays the current Delta value.
The table changes its background according to the strength of Delta:
Delta ≥ 5 → strong positive momentum.
Delta > 0 → positive momentum.
Delta ≤ 0 → negative momentum.
This gives the trader an immediate numerical reading of current momentum.
Alerts
The indicator contains alerts for both the direction and strength of Delta.
Trend alerts
Buy — Delta Line Rise
Triggered when Delta is rising compared with the previous candle.
Sell — Delta Line Fall
Triggered when Delta is falling compared with the previous candle.
Delta-level alerts
The indicator also provides bullish/bearish conditions around:
10
5
3
0.3
0
These thresholds allow traders to monitor different levels of momentum strength.
For example, a Delta above 5 represents considerably stronger positive momentum than simply being above zero.
Overall Interpretation
The Delta Trend indicator can be viewed as a short-term momentum and momentum-direction tool.
Its readings can be interpreted broadly as:
Positive Delta + Rising Delta
→ Positive momentum is strengthening.
Positive Delta + Falling Delta
→ Momentum remains positive but is weakening.
Negative Delta + Falling Delta
→ Negative momentum is strengthening.
Negative Delta + Rising Delta
→ Bearish momentum is weakening and a potential momentum transition may be developing.
The combination of the Delta level and the direction of the Delta Line is therefore more informative than either one by itself.
Example
If the indicator shows:
Delta = +6.2x
Delta Line = Rising
this suggests that the current smoothed price momentum is strongly positive and is increasing.
If it subsequently changes to:
Delta = +4.1x
Delta Line = Falling
the momentum is still positive, but its strength is declining.
If Delta eventually moves below 0, the indicator has transitioned into negative momentum.
Important Limitation
Delta Trend should not be interpreted as true order-flow or buy/sell volume delta.
Unlike an exchange-provided bid/ask delta, this indicator does not measure actual buyer-initiated versus seller-initiated trades. It derives its value entirely from the relationship between open and close prices.
Therefore, it is more accurately described as a smoothed price-momentum/directional-pressure indicator, rather than a true volume-delta indicator.
In simple terms
Delta Trend answers two questions:
1. Is price momentum positive or negative?
and
2. Is that momentum getting stronger or weaker?
The Delta value tells you the approximate strength of the momentum, while the rising/falling state of the Delta Line tells you whether that momentum is increasing or decreasing.
Indicatore

Multi-Timeframe Hull Moving Average (HMA) Candle Projection### Overview
The **Multi-Timeframe Hull Moving Average (HMA) Candle Projection** is a lightweight, clean chart overlay designed for traders utilizing multi-timeframe analysis.
Instead of traditional higher timeframe candlestick data, this tool applies a **Hull Moving Average (HMA)** calculation directly to the Open, High, Low, and Close (OHLC) values of a higher session. This extracts the noise-filtering benefits of a Hull Moving Average while still structuring the resulting data into recognizable candle bodies and wicks.
### Key Features
* **Live Sidebar Projection:** Rather than plotting blocks directly on top of your current price chart, this script cleanly isolates the real-time higher timeframe Hull candle to the right margin of your layout. This keeps your execution window clutter-free.
* **Lag Minimization:** By processing structural candle boundaries through the Hull formula, it smooths out higher timeframe data without introducing the heavy lag associated with standard simple moving averages.
* **Pine Script v6 Compliant:** Rewritten using the strict syntax rules of version 6 to ensure rapid rendering and seamless compatibility with modern TradingView engine performance metrics.
### How to Read & Use
1. **Trend Identification:** When the projected candle body is green, the higher timeframe Hull trend is bullish (Close >= Open). When it is red, the higher timeframe Hull trend is bearish (Close < Open).
2. **Top-Down Coordination:** This is highly effective for filtering micro-execution charts against macro-trends. For example, look for long setups on a 5-minute chart only when the 15-minute or 1-hour projected Hull candle on the right is green.
3. **Settings Controls:** Double-click the indicator to alter the higher timeframe source resolution (e.g., changing it from 15 to 60 or W for Weekly), modify the HMA lookback length (default is 9), or shift the candle further into your right margin screen space.
Indicatore

Pressure DeltaPressure Delta is a volume-weighted candle-pressure indicator designed to identify directional participation and unusually strong buying or selling activity. It estimates buy and sell pressure from the candle's closing position and wick structure, distributes the candle's volume according to that estimated pressure, and then normalizes the resulting directional delta against average volume. The indicator combines Pressure, Relative Volume Delta, Relative Volume Percentage, Delta Spike and Relative Volume to distinguish ordinary price movement from high-volume directional events.
The most useful way to think about it is:
Pressure = direction
RVoL = participation
RVoL Δ = directional participation
RVoL % = imbalance
Spike = unusualness
1. The core idea: estimating buy vs. sell pressure
The script first examines the candle:
high
low
open
close
volume
It calculates the candle's range:
candleRange = high - low
Then it asks two questions:
Where did the candle close within its range?
closeRatio = (close - low) / range
A close near the high gives a value close to 1.
A close near the low gives a value close to 0.
It also examines the wicks:
wickBias = (lowerWick - upperWick) / range
A relatively large lower wick contributes bullish pressure, while a relatively large upper wick contributes bearish pressure.
Those two components are then combined:
buyPressureRaw =
60% × close location
+ 40% × wick bias
So the indicator gives 60% weight to where the candle closes and 40% weight to the wick structure.
2. Pressure
This is probably the most intuitive component.
pressureFinal = buyPressureRaw × 100
So it produces a number between approximately:
0% → 100%
Conceptually:
0–20% → very strong selling pressure
20–40% → bearish pressure
40–50% → mildly bearish/neutral
50–60% → mildly bullish
60–70% → bullish
70–85% → strong bullish pressure
85–100% → very strong bullish pressure
Your chart labels the last 7 candles with this value.
The colors reinforce the interpretation:
🟢 >60 = bullish
🟡 40–60 = neutral/mixed
🔴 <40 = bearish
Example
Suppose a candle:
opens at 100
trades to 95
trades to 108
closes at 107
The close is very near the high, and the candle may have a relatively meaningful lower wick.
The algorithm therefore might calculate something like:
Pressure = 82%
That means:
"Based on this candle's structure, the indicator estimates strong buying dominance."
It does not mean that exactly 82% of actual trades were buys.
3. Estimated buy and sell volume
The script takes the estimated pressure and applies it to the candle's volume:
buyVol = buyPressureRaw × volume
sellVol = sellPressureRaw × volume
For example, imagine:
Volume = 1,000,000
and:
Pressure = 70%
The script estimates:
Buy volume ≈ 700,000
Sell volume ≈ 300,000
Then:
netDelta = buyVol - sellVol
giving:
+400,000
Again, this is modelled volume, not exchange-reported buy/sell volume.
4. RVoL — Relative Volume
The script calculates a 20-bar average volume:
avgVol = ta.sma(volume, 20)
Then:
rvol = volume / avgVol
So if:
Current volume = 2,000,000
and:
20-bar average = 1,000,000
then:
RVoL = 2.0x
Meaning:
The current candle traded approximately twice the normal volume.
This is useful because pressure by itself isn't necessarily meaningful.
A candle showing 80% pressure on extremely low volume is very different from an 80% pressure candle occurring on 3× normal volume.
5. RVoL Δ — probably one of the most important readings
The script calculates:
rvolBuy = buyVol / avgVol
rvolSell = sellVol / avgVol
and:
rvDelta = rvolBuy - rvolSell
This combines directional pressure + abnormal volume.
For example:
Scenario A
Pressure = 70%
RVoL = 1×
You might get a relatively modest positive RVoL Delta.
Scenario B
Pressure = 70%
RVoL = 3×
The RVoL Delta becomes much larger.
That's because the second candle has substantially more volume behind the estimated buying pressure.
So conceptually:
RVoL Δ attempts to measure the strength of directional volume pressure relative to normal volume.
Your alerts use thresholds of:
5, 6 and 7
So you're essentially saying:
"Alert me when estimated buying pressure is not only positive, but exceptionally large relative to normal volume."
6. RVoL %
This calculation is:
rvPct = (rvDelta / rvol) × 100
This is interesting because it normalizes the delta by total relative volume.
Mathematically, it effectively brings you back toward the buy/sell imbalance expressed as a percentage of volume.
For example:
+50%
means the estimated buying component is substantially greater than the estimated selling component.
The indicator colors:
>50% = green
0–50% = yellow
<0% = red
Your alerts are focused on 40% and 50%.
7. Spike
This is designed to identify unusually large directional-volume events.
The script calculates:
avgAbsDelta = ta.sma(math.abs(rvDelta), 5)
Then:
spike = rvDelta / avgAbsDelta
In other words:
How large is the current directional volume delta compared with the average magnitude of the last five deltas?
For example:
Spike = 0.5×
Normal-ish / relatively weak.
Spike = 1×
Around the recent average.
Spike = 2×
Approximately twice the recent average magnitude.
Spike = 4×
A potentially significant directional-volume event.
Your table highlights values above 2×.
One subtle point: because the denominator uses abs(rvDelta) but the numerator retains its sign, a large negative event can produce a strongly negative Spike.
Indicatore

Indicatore
