Balanced Price Range + V-Shape IndicatorBalanced Price Range + V-Shape Indicator
Overview
This is an open-source intraday scalping model built on ICT-derived price-action concepts. It combines Balanced Price Ranges and V-shaped liquidity-driven reversals into a single contextual system. The scalping method is specific: it looks for a sharp reversal (a "V") off a zone of overlapping imbalance (a Balanced Price Range), but only when that zone is confirmed by higher-timeframe imbalance or a recent liquidity sweep — the kind of fast, location-specific entry used on 1–15 minute charts. Rather than printing every BPR or inverted gap (which is unusably noisy live), it cross-filters them so only confirmed locations are highlighted. The source is fully open; everything below describes exactly what the code does.
Building block 1 — Fair Value Gaps and inversions
A Fair Value Gap (FVG) is a three-candle imbalance: a gap between candle 1's extreme and candle 3's extreme left unfilled by candle 2. The script detects each FVG as it forms and stores the displacement (middle) candle's open and close for later momentum checks. When price later closes back through a gap, that gap is latched as inverted (an iFVG) — its expected support/resistance role flips.
Building block 2 — Balanced Price Range
A Balanced Price Range is the price overlap between a fresh FVG and an opposite-direction iFVG. When a new FVG forms and overlaps an opposite inverted gap within a configurable lookback window, the overlapping band is drawn as a BPR. A minimum-size filter (as a percentage of 14-period ATR) discards slivers too thin to matter. BPR zones extend rightward until price closes through them or a max-extension bar limit is reached.
Building block 3 — Liquidity mapping and sweeps
The script independently maps liquidity from four sources, each toggleable: swing-pivot highs/lows, equal highs/lows (two same-side swings within an ATR tolerance), previous-day high/low, and London / NY-AM session highs and lows. For each level it distinguishes a sweep (wick through, close back — liquidity grab) from a clean break (close beyond — level reclaimed), marking sweeps on the chart.
The V-Shape gate — how the pieces work together
A BPR is upgraded to a "V-BPR" and an entry arrow only fires when the location passes a context gate with two independent confirmation paths, either of which validates the setup:
HTF FVG tap (continuation path): Fair Value Gaps are read from a higher timeframe (chart TF × a user multiplier, snapped to the nearest standard resolution). The gate checks whether price recently tapped a still-valid HTF gap of matching direction, and whether the BPR sits inside or within an ATR buffer of it.
Liquidity sweep (reversal path): a correct-side sweep — a low taken for a long, a high taken for a short — within a recent bar window.
Two candle-level filters refine the trigger: a clean-V-tip rule (the inversion candle must be preceded by an opposite-direction candle, enforcing a real reversal at the tip) and a strong-close rule (the inverting candle must reclaim a set percentage of the displacement candle's body, confirming momentum). An optional clear-path filter rejects a setup when un-swept opposite-side liquidity rests within an ATR danger zone in the trade's direction, since that pool is often taken first.
Chart Examples:
Settings reference
Settings: max BPRs shown, iFVG lookback window, min BPR size (% ATR), max zone extension.
Higher-TF FVG: show/hide, timeframe multiplier, max stored, colour.
V-Shape Gate & Entry: master gate toggle, HTF-tap window, zone proximity buffer, sweep-path toggle and window, clean-V-tip, clear-path toggle and danger-zone size, hide-non-V-BPR, entry-marker toggle, strong-close percentage.
Liquidity & Sweeps: toggles for swing / PDH-PDL / session / equal-H-L sources, pivot strength, equal tolerance, session windows (NY time), max levels, sweep marking, colours.
Colors: bull/bear BPR, FVG/iFVG components, liquidity, sweep marks.
How to use it
Apply to 1–15 minute charts. Drawn BPRs show overlapping imbalance; thicker V-BPR zones and ▲/▼ markers show locations that passed the gate. Each entry marker's tooltip audits why it fired (which path confirmed it and the reclaim %). Begin with the gate on to see only confirmed scalps; loosen by disabling individual filters, or enable "Hide BPRs that fail the gate" to declutter. Alerts fire on confirmed long and short V-Shape entries.
Non-repainting
All higher-timeframe and previous-day data is requested with offset historical expressions, so no future data is used on historical bars; entries evaluate only on confirmed bar closes and do not repaint. Indicator

Volatility Shape Classifier [AGPro Series]Volatility Shape Classifier
🔹 Overview
Volatility Shape Classifier is a context and diagnostics tool that does not stop at telling you whether volatility is high or low. Instead it classifies the SHAPE of that volatility on every bar — Smooth, Chaotic, Choppy, Drift, or Dead — using three independent dimensions combined into a single regime read. The result is a continuous visual narrative made of a subtle background tint, throttled transition badges, and a compact metrics panel.
It is designed to sit on your chart as a pure awareness layer. It does not generate buy or sell signals and it is not a trading strategy.
🔷 Unique Edge
Most volatility tools compress the market into one axis — high vs low (ATR, Bollinger Band Width), or trend vs range (Choppiness Index, ADX). They answer half of the question.
This script asks three questions at once and fuses the answers:
1. Magnitude — is ATR above or below its own long baseline?
2. Smoothness — are bar-to-bar moves consistent in size, or erratic?
3. Directional Consistency — do bars point the same way, or cancel each other?
Only the combination of these three can distinguish a controlled trend run (Smooth) from a violent whipsaw (Chaotic) from a wide directionless thrash (Choppy) — all three of which can show identical ATR readings. That shape distinction is the core value this script adds, and it is the gap left by standard volatility and chop indicators.
🔶 Methodology
Engine layer (per bar):
• Volatility Level = ATR(volLen) / SMA(ATR, volLen * 3)
• Smoothness = StDev(|close − close |) / SMA(|close − close |) over volLen
• Direction = |sum(close − close )| / sum(|close − close |) over volLen
Classification layer maps the three readings into six mutually exclusive codes:
0 — Forming (warm-up / in-between space, no tint)
1 — Expansion · Smooth (high vol, low CV, directional)
2 — Expansion · Chaotic (high vol, high CV)
3 — Expansion · Choppy (high vol, low direction)
4 — Low-Vol · Drift (low vol, low CV, mild direction)
5 — Low-Vol · Dead (low vol, low CV, no direction)
Stability layer applies a configurable Confirmation Bars window so a new shape must persist for N consecutive bars before the chart commits to it. This prevents single-bar flicker. Between-state readings do not reset the current shape, they hold it — avoiding the classic "blink to neutral" problem of switch-based classifiers.
🔸 Signals & Alerts
Four alert conditions are published:
• Shape Shifted to Smooth Expansion
• Shape Shifted to Chaotic Expansion
• Shape Shifted to Choppy Expansion
• Shape Collapsed (any expansion state falling into low-vol Drift or Dead)
Alerts fire only on confirmed shape transitions and only on bar close, so repaint on the signal bar is not a concern.
🔹 Key Inputs
• Volatility Length — window for ATR, smoothness, and direction (default 20)
• Confirmation Bars — persistence requirement before committing to a new shape (default 3)
• Badge Cooldown — minimum bars between visible badges (default 15; tint updates continuously regardless)
• Panel Position / Size — six anchor points, four size presets
• Badge Font Size — four size presets
🔷 How to Use
• Use the SHAPE read as a setup filter, not as the signal itself. Smooth Expansion is where trend-following tools tend to perform well. Chaotic and Choppy Expansion are where they tend to fail even when the raw volatility reading looks attractive.
• The Drift state often precedes an expansion in the direction of the drift.
• The Dead state is a compression warning — a shape collapse alert from Expansion into Dead is a common precursor to a fresh expansion move in either direction.
• Pair with your own entry logic (structure, moving averages, volume). This tool answers "what kind of market am I in right now?" — it does not answer "where do I enter?"
🔶 Limitations & Transparency
• Thresholds (1.15x / 0.70x / 0.80 / 1.10 / 0.18) were tuned on crypto and FX data across 15m to 1D timeframes. Very illiquid instruments and very low timeframes (< 5m) may require a longer Volatility Length.
• Shape classification is inherently backward-looking (it reads the last volLen bars). It describes the character of recent volatility, not future volatility.
• The script is a context layer. It is not a strategy and should not be used in isolation for trade decisions.
• Past behavior of a shape does not guarantee future behavior.
🔸 Risk Disclosure
This indicator is an educational and analytical tool. It does not constitute financial advice, trade recommendations, or a signal service. All trading involves risk. You are solely responsible for your own trading decisions. Indicator

Auction Intelligence█ AUCTION INTELLIGENCE
Auction Market Theory Overlay
An Auction Market Theory (AMT) overlay that analyzes market structure through volume profile analysis. It detects profile shape (D/P/b/DD), identifies balance vs. imbalance states, and tracks value migration — giving you the same auction-based framework used by institutional traders to understand market behavior.
Free and Open Source.
█ THE CONCEPT: WHY AUCTION MARKET THEORY MATTERS
Standard indicators tell you what happened. AMT tells you why . Markets are continuous two-sided auctions where buyers and sellers negotiate fair value:
Balance — Price rotates within an accepted value area. Expect mean-reversion and range-bound trading.
Imbalance — Price breaks away from the value area. One side dominates. Expect continuation.
Profile Shape — The distribution of volume tells you who is in control and what to expect next.
Value Migration — The direction where the POC and Value Area are shifting reveals the underlying trend.
█ CORE FEATURES
1. Volume Profile Engine
Distributes each bar's volume proportionally across price rows, building a volume-at-price distribution:
POC (Point of Control) — Highest volume row = strongest S/R level
VAH (Value Area High) — Upper boundary of the 70% value area = resistance
VAL (Value Area Low) — Lower boundary of the 70% value area = support
2. Profile Shape Detection
Automatically classifies the volume distribution into four distinct shapes:
D-shape — Balanced. Volume evenly distributed, POC near center. Expect rotation.
P-shape — Bullish. Volume concentrated in upper half. Buyers in control.
b-shape — Bearish. Volume concentrated in lower half. Sellers in control.
DD (Double Distribution) — Two distinct volume clusters. Market transitioning between value areas.
3. Balance vs. Imbalance Recognition
Three-factor analysis combining price position, VA width dynamics, and trend strength. The chart background colors automatically when imbalance is detected (cyan = bullish discovery, red = bearish discovery).
4. Value Migration Tracker
Monitors how the POC and Value Area midpoint shift over time:
Bullish Migration ▲ — POC and VA migrating higher = institutional buying
Bearish Migration ▼ — POC and VA migrating lower = institutional selling
Neutral ─ — No significant migration = consolidation
█ AUTO-TIMEFRAME ADAPTATION
All parameters automatically adjust based on the chart timeframe:
1-5 min → Lookback 30, 18 Rows, Migration Len 5
15-30 min → Lookback 40, 20 Rows, Migration Len 8
1 Hour → Lookback 50, 24 Rows, Migration Len 10
4 Hour → Lookback 70, 28 Rows, Migration Len 15
Daily → Lookback 100, 32 Rows, Migration Len 20
Weekly+ → Lookback 150, 40 Rows, Migration Len 30
Disable Auto-TF to use manual settings for full control.
█ DASHBOARD
A compact, dark-themed info panel displaying:
State — Current AMT state (BALANCE / IMBALANCE) with context
Shape — Detected profile shape (D / P / b / DD) with description
Migration — Value migration direction and strength
Position — Current price position relative to Value Area
POC / VAH / VAL — Key volume-based levels
█ ALERTS (4 CONDITIONS)
Balance → Imbalance — Market leaving the value area
Imbalance → Balance — Market returning to the value area
Profile Shape Changed — Volume distribution pattern shift
Value Migration Shift — Directional bias change in POC/VA migration
█ PRO VERSION
The PRO version (Auction Intelligence PRO v2.0) adds:
Initial Balance Range — IB Tracking + IB Extension Detection
Failed Auction Detection — VA Breakout Failures
Excess & Poor High/Low — Wick analysis at session extremes
Auction Rotation Factor — POC-cross frequency as market efficiency measure
Day Type Classification — Trend/Normal/Normal Var./Neutral/Double Dist. (Dalton)
Previous Day Value Area — PDPOC/PDVAH/PDVAL as reference levels
Enhanced Confluence Score — 0-12 scale with A+ to D grading
13 Alert Conditions
█ NON-REPAINTING
The volume profile is calculated from confirmed bar data only. The rolling lookback window recalculates on each confirmed bar using historical high/low/volume — no future data is used. No repainting.
█ WORKS ON
Crypto, Forex, Stocks, Futures, Indices — any timeframe from 1 minute to Monthly.
█ DISCLAIMER
This indicator is for educational and informational purposes only. It does not constitute financial advice. Always do your own research and manage your risk. Past performance does not guarantee future results. Trading involves substantial risk of loss.
Indicator

Volume Flow Analysis [UAlgo]Volume Flow Analysis is a price mapped volume study that distributes historical activity across price levels and separates that activity into directional pressure, stealth style movement, imbalance zones, absorption zones, Point of Control, Value Area, and profile shape. Instead of reading volume only bar by bar, the script converts a rolling section of chart history into a horizontal market map where each price level receives its own buy pressure, sell pressure, and movement efficiency profile.
The script works on the latest bar and rebuilds the full map from a rolling historical window. That window can either use the full user selected lookback or a shorter effective depth when decay is enabled. This gives more recent bars a stronger influence while older bars gradually lose weight. The result is a profile that can behave either like a stable historical map or like a more adaptive flow view depending on the selected decay factor.
Inside each price bucket, the script estimates directional pressure by splitting volume into buy side and sell side portions based on where price closed inside the bar range. It then distributes those portions across all buckets touched by the bar using proportional overlap. At the same time, it builds a separate stealth flow style measure based on range per unit of volume, which acts as a proxy for how much price movement occurred relative to participation.
From there, the script identifies the Point of Control, expands outward to build the seventy percent Value Area, classifies the overall profile shape, highlights extreme buy or sell imbalances, detects absorption style conditions, and optionally extends those key zones across the historical range. A legend table summarizes the active state of the map so the user can read the distribution quickly.
In practical use, Volume Flow Analysis is useful for studying where participation concentrated, where directional pressure was strongest, where flow became unbalanced, and whether the profile currently resembles a balanced, short covering, long liquidation, or double distribution structure.
🔹 Features
🔸 Price Bucket Volume Mapping
The script divides the active price range into user defined buckets and allocates volume into those levels according to actual price overlap. This creates a true horizontal flow map instead of a simple vertical volume display.
🔸 Buy Pressure and Sell Pressure Separation
Each price bucket stores both estimated buy side volume and estimated sell side volume. These two components are then drawn side by side so the user can see which side dominated each price level.
🔸 Decay Weighted Historical Memory
Older bars can gradually lose influence through the decay factor. This lets the profile emphasize fresher activity while still preserving historical structure.
🔸 Stealth Flow Layer
The script includes an additional stealth flow style metric based on range relative to volume. This highlights zones where price moved efficiently with relatively less participation.
🔸 Point of Control and Value Area
The indicator automatically finds the highest volume bucket as the Point of Control and expands from that level until seventy percent of total volume is captured to form the Value Area.
🔸 Imbalance Detection
Price levels with one sided pressure above the selected imbalance ratio are highlighted as buy or sell imbalance zones. These can also be extended across the profile range.
🔸 Absorption Detection
Buckets with unusually high total volume but unusually low stealth flow are marked as absorption. This can suggest heavy participation with reduced price efficiency.
🔸 Profile Shape Classification
The script classifies the overall profile as D shape, B shape, P shape, or b shape using the distribution of volume across the upper, middle, and lower thirds of the profile.
🔸 Range Box and Historical Scope Label
A dashed range box shows the active calculation window and displays the effective number of bars used in the current map.
🔸 Built In Legend and Summary Table
A table in the lower right corner explains the map colors and also reports the current buy sell balance, profile shape, and whether imbalance or absorption layers are active.
🔹 Calculations
1) Determining the Effective Historical Window
int nCalc = i_decay == 1.0 ? i_lookback : int(math.ceil(math.log(0.01) / math.log(i_decay)))
int N = math.max(1, math.min(nCalc, i_lookback))
N := math.min(N, bar_index)
This is the first major step of the script.
If decay is set to 1.0, the script simply uses the full user selected lookback.
If decay is below 1.0, the script solves for how many bars are needed until the decay weight falls to roughly one percent of its original value. That value becomes the effective calculation depth.
Then the script clamps that depth so it never exceeds the lookback input and never exceeds available chart history.
So the map can behave in two different ways:
a full fixed history profile,
or a dynamically shortened profile where older bars become practically irrelevant.
2) Finding the Active Price Range and Bucket Size
float pH = high
float pL = low
for i = 0 to N - 1
pH := math.max(pH, high )
pL := math.min(pL, low )
float bSz = (pH - pL) / i_buckets
This block establishes the vertical bounds of the map.
The script scans the effective historical window and finds the highest price and lowest price inside it. Then it divides that full range by the selected number of price levels.
The result is the bucket size, which determines the height of every price cell in the flow map.
So the whole analysis space is always defined by the actual recent trading range rather than by arbitrary static levels.
3) Initializing Buy, Sell, and Stealth Arrays
array bVol = array.new(i_buckets, 0.0)
array sVol = array.new(i_buckets, 0.0)
array stV = array.new(i_buckets, 0.0)
These three arrays are the main storage layer of the profile.
bVol stores buy pressure per bucket.
sVol stores sell pressure per bucket.
stV stores the stealth flow style metric per bucket.
As each historical bar is processed, its weighted contribution is distributed into these arrays according to price overlap.
So the script is building three parallel price maps at the same time.
4) Splitting Each Bar Into Buy and Sell Pressure
float b_v = rng == 0 ? (v_i / 2) : (v_i * (c_i - l_i) / rng)
float s_v = v_i - b_v
This is the directional volume model.
If a bar has zero range, volume is split evenly between buy side and sell side.
Otherwise, the script estimates buy pressure from where the close sits inside the bar range. A close nearer the high gives more weight to buy pressure. A close nearer the low gives less weight to buy pressure. Sell pressure is simply the remainder.
This is not exchange level aggressor data, but it is a practical price location based estimate of directional pressure inside each candle.
So every bar contributes both a buy component and a sell component to the profile.
5) Defining the Stealth Flow Proxy
float st_m = v_i == 0 ? rng : rng / v_i
This line creates the stealth flow style measurement.
The idea is simple. If price covers a relatively large range with relatively little volume, the ratio becomes larger. If price needs heavy volume to achieve the same range, the ratio becomes smaller.
So this metric behaves like a movement efficiency proxy:
higher values suggest cleaner movement per unit of volume,
lower values suggest heavier participation per unit of movement.
It is important to interpret this as a derived proxy rather than a direct exchange measured stealth order flow.
6) Applying Decay Weight to Historical Bars
float d_m = math.pow(i_decay, i)
Every historical bar receives a decay multiplier based on how far back it is.
The most recent bar gets the largest weight. Older bars receive progressively smaller weights as long as decay is below one.
This means the final profile is not just a raw accumulation of past activity. It is a weighted accumulation where recent flow can dominate older structure if the user wants a more adaptive map.
7) Distributing a Bar Across All Touched Buckets
int minIdx = math.max(0, math.floor((l_i - pL) / bSz))
int maxIdx = math.min(i_buckets - 1, math.floor((h_i - pL) / bSz))
for j = minIdx to maxIdx
float b_min = pL + j * bSz
float b_max = b_min + bSz
float ovr = math.max(0, math.min(h_i, b_max) - math.max(l_i, b_min))
if ovr > 0
float prop = ovr / rng
bVol.set(j, bVol.get(j) + b_v * prop * d_m)
sVol.set(j, sVol.get(j) + s_v * prop * d_m)
stV.set(j, stV.get(j) + st_m * prop * d_m)
This is one of the most important calculations in the whole script.
For every bar, the script determines which price buckets were touched by that bar. It then measures how much of the bar overlapped each bucket. That overlap fraction is used to distribute buy pressure, sell pressure, and stealth flow into the correct levels.
So if a bar spends more of its range inside a given bucket, more of its volume contribution goes into that bucket.
This makes the map much more realistic than assigning the full bar volume to only one price level.
8) Handling Zero Range Bars
else
int idx = math.max(0, math.min(i_buckets - 1, math.floor((c_i - pL) / bSz)))
bVol.set(idx, bVol.get(idx) + b_v * d_m)
sVol.set(idx, sVol.get(idx) + s_v * d_m)
stV.set(idx, stV.get(idx) + st_m * d_m)
If a bar has no range, the script cannot distribute it by overlap. In that case, it assigns the full weighted contribution to the bucket containing the close.
This ensures that flat or compressed bars still contribute to the profile without breaking the overlap logic.
9) Building Total Volume, Point of Control, and Summary Totals
float tVolMax = 0.0
float stMax = 0.0
float stMin = 1e10
int poc = 0
float pocV = 0.0
float sumV = 0.0
array tVol = array.new(i_buckets, 0.0)
for j = 0 to i_buckets - 1
float t = bVol.get(j) + sVol.get(j)
float st = stV.get(j)
tVol.set(j, t)
sumV += t
if t > tVolMax
tVolMax := t
if t > pocV
pocV := t
poc := j
After all bars are processed, the script combines buy and sell pressure for each bucket into total volume.
At the same time, it calculates:
the total profile volume,
the maximum bucket volume,
the Point of Control bucket,
and the minimum and maximum stealth values.
The Point of Control is simply the bucket with the largest accumulated total volume.
So this stage turns the raw arrays into a complete profile summary.
10) Calculating the Seventy Percent Value Area
float trg = sumV * 0.70
float cur = pocV
int vH = poc
int vL = poc
while cur < trg and (vH < i_buckets - 1 or vL > 0)
float vUp = vH < i_buckets - 1 ? tVol.get(vH + 1) : -1.0
float vDn = vL > 0 ? tVol.get(vL - 1) : -1.0
if vUp >= vDn and vUp >= 0
vH += 1
cur += vUp
else if vDn > vUp and vDn >= 0
vL -= 1
cur += vDn
else
break
This is the Value Area expansion algorithm.
The script starts at the Point of Control and keeps adding the next larger neighboring bucket, either above or below, until the accumulated total reaches seventy percent of overall profile volume.
The upper and lower boundaries of that expansion become the Value Area High and Value Area Low.
So the Value Area always forms around the Point of Control and grows toward whichever neighboring levels contain the most activity.
11) Classifying the Profile Shape
float vTop = 0.0
float vMid = 0.0
float vBot = 0.0
int third = math.floor(i_buckets / 3)
for j = 0 to i_buckets - 1
float v = tVol.get(j)
if j < third
vBot += v
else if j < third * 2
vMid += v
else
vTop += v
string shp = "D-Shape (Balanced)"
if vTop > sumV * 0.20 and vBot > sumV * 0.20 and vMid < sumV * 0.50
shp := "B-Shape (Double Dist)"
else if poc > i_buckets * 0.5 and vTop > vBot * 1.3
shp := "P-Shape (Short Covering)"
else if poc < i_buckets * 0.5 and vBot > vTop * 1.3
shp := "b-Shape (Long Liquidation)"
The script divides the profile into upper, middle, and lower thirds and compares how much volume sits in each section.
If upper and lower thirds both carry meaningful volume while the middle is relatively weak, the script labels the profile as a B shape.
If the Point of Control sits high and the upper section dominates, it labels the profile as a P shape.
If the Point of Control sits low and the lower section dominates, it labels the profile as a b shape.
Otherwise, the default label is D shape.
So the shape classifier is reading where the distribution is concentrated and how balanced it looks across the full price range.
12) Computing the Average Stealth Level
float avgSt = 0.0
int stCnt = 0
for j = 0 to i_buckets - 1
if stV.get(j) > 0
avgSt += stV.get(j)
stCnt += 1
avgSt := stCnt > 0 ? avgSt / stCnt : 0.0
This block computes the average positive stealth value across all populated buckets.
That average later becomes part of the absorption logic. Buckets with much lower than average stealth, combined with very high total volume, are flagged as absorption.
So the script uses the stealth map not only for display width, but also for analysis.
13) Detecting Imbalances and Absorption
bool imbB = i_showImb and s > 0 and b / s >= i_imbRatio
bool imbS = i_showImb and b > 0 and s / b >= i_imbRatio
bool absr = i_showAbs and t > avgV * 1.5 and st < avgSt * 0.5
These are the main analytical event conditions.
A buy imbalance exists when buy pressure is at least the selected ratio times larger than sell pressure.
A sell imbalance exists when sell pressure is at least the selected ratio times larger than buy pressure.
Absorption is defined differently. It requires:
total bucket volume above one and a half times the average bucket volume,
and stealth flow below half the average stealth value.
That means the bucket saw heavy participation but relatively poor movement efficiency, which can suggest absorbed flow.
So imbalances mark one sided aggression, while absorption marks heavy activity with suppressed movement.
14) Scaling the Visual Width of Each Layer
int wS = int((s / tVolMax) * i_width)
int wB = int((b / tVolMax) * i_width)
int wSt = int(((st - stMin) / math.max(1e-10, stMax - stMin)) * (i_width / 2))
The map is drawn horizontally, so the script converts each metric into width.
Sell pressure width and buy pressure width are scaled relative to the largest total bucket volume.
Stealth flow width is scaled separately relative to the stealth range and is limited to half the main map width.
So every bucket gets a visual footprint that reflects its relative pressure and stealth intensity.
15) Drawing the Buy, Sell, and Stealth Blocks
if wS > 0
_boxes.push(box.new(xStart, pHi, xStart + wS, pLo, bgcolor = cS, border_color = bc, border_width = bw))
if wB > 0
_boxes.push(box.new(xStart + wS, pHi, xStart + wS + wB, pLo, bgcolor = cB, border_color = bc, border_width = bw))
if i_showSt and wSt > 0
_boxes.push(box.new(xStart + wS + wB, pHi, xStart + wS + wB + wSt, pLo, bgcolor = c_stealth, border_color = bc, border_width = 1))
This is the actual map renderer.
The sell block is drawn first.
The buy block is drawn immediately after it.
If stealth flow display is enabled, the stealth block is drawn after both pressure blocks.
So each price level becomes a compact three part flow bar:
sell pressure,
buy pressure,
and optional stealth flow.
16) Extending Imbalance and Absorption Zones Across the Range
if i_showZones
if imbB
_boxes.push(box.new(bar_index - N + 1, pHi, bar_index + 1, pLo, bgcolor = color.new(c_buy, 90), border_color = na))
if imbS
_boxes.push(box.new(bar_index - N + 1, pHi, bar_index + 1, pLo, bgcolor = color.new(c_sell, 90), border_color = na))
if absr
_boxes.push(box.new(bar_index - N + 1, pHi, bar_index + 1, pLo, bgcolor = color.new(color.rgb(255, 0, 255), 85), border_color = na))
If zone extension is enabled, the script projects imbalance and absorption buckets horizontally across the entire historical calculation window.
This makes key buckets easier to see in relation to actual price bars rather than only inside the right side profile map.
So the indicator can show both a profile view and a chart level zone view at the same time.
17) Drawing the Range Box and Historical Scope Label
if i_showRng
_boxes.push(box.new(bar_index - N + 1, pH, bar_index + 1, pL, bgcolor = na, border_color = c_range, border_style = line.style_dashed))
_labels.push(label.new(bar_index - int(N / 2) + 1, pH, "N: " + str.tostring(N), textcolor = c_range, style = label.style_label_down, color = color.new(color.black, 100), size = size.small))
This block outlines the active analysis window on the chart.
The dashed box marks the highest and lowest prices used by the profile, and the label shows the effective bar count N.
So the user can always see exactly which portion of chart history is feeding the current flow map.
18) Drawing the Point of Control
if i_showPOC
float pPrice = pL + (poc + 0.5) * bSz
int endX = i_extPOC ? bar_index + i_width : bar_index + 1
_lines.push(line.new(bar_index - N + 1, pPrice, endX, pPrice, color = c_poc, width = 2))
The Point of Control line is drawn at the midpoint of the highest volume bucket.
If extension is enabled, the line continues forward through the map width. Otherwise it stops at the right edge of the historical window.
So the Point of Control remains a clear reference level for the most active price area inside the map.
19) Drawing the Value Area
if i_showVA
float vaTop = pL + (vH + 1) * bSz
float vaBot = pL + vL * bSz
_boxes.push(box.new(bar_index + 1, vaTop, bar_index + 1 + i_width, vaBot, border_color = c_va, bgcolor = color.new(c_va, 90), border_style = line.style_dashed))
This draws the seventy percent Value Area as a translucent box on the right side of the profile.
The top and bottom are derived from the expanded Value Area bucket boundaries, and the box spans the full map width.
So the user can immediately see where most of the profile activity was concentrated around the Point of Control.
20) Buy Sell Dominance Summary
float tB = bVol.sum()
float tS = sVol.sum()
float tV = tB + tS
float pB = tV > 0 ? (tB / tV) * 100 : 0
float pS = tV > 0 ? (tS / tV) * 100 : 0
string dTxt = pB >= pS ? "Bullish " + str.tostring(pB, "#") + "%" : "Bearish " + str.tostring(pS, "#") + "%"
This block calculates the total buy side share and total sell side share across the whole profile.
Whichever side holds the greater percentage becomes the dominant flow label in the table.
So the summary does not only show local bucket conditions. It also provides a broad view of which side controlled more of the weighted participation inside the entire mapped range. Indicator

Birdies [LuxAlgo]The Birdies indicator uses a unique technique to provide support/resistance curves based on a circle connecting the last swing high/low.
A specific, customizable part of this circle acts as a curve of interest, which can trigger visual breakout signals.
🔶 USAGE
The script projects a bird-like pattern when a valid Swing point is found. Multiple customization options are included.
🔹 Trend & Support/Resistance Tool
The color fill patterns and the wing boundaries can give insights into the current trend direction as well as serve as potential support/resistance areas.
In the example above, "Birdies" coincide with pullback and support/resistance zones.
🔹 Swing Length & Buffer
Besides the "Swing Length", with higher values returning longer-term Swing Levels, the script's behavior can be fine-tuned with filters ("Settings" - "Validation").
🔹 Validation
To minimize clutter, three filters are included:
Minimum X-Distance: The minimum amount of bars between subsequent Swings
Minimum Y-Distance: The minimum amount of bars between subsequent Swings
Buffer (Multiple of ATR)
The "Minimum X/Y-Distance" creates a zone where a new Swing is considered invalid. Only when the Swing is out of the zone, can it be considered valid.
In other words, in the example above, a Swing High can only be valid when enough bars/time have passed, and the difference between the last Swing and the previous is more than the ATR multiplied by the "Minimum Y-Distance" factor.
The "Buffer" creates a line above/below the "Birdy", derived from the measured ATR at the conception of the "Birdy" multiplied with a factor ("Buffer").
When the closing price crosses the "Birdy", it must also surpass this buffer line to produce a valid signal, lowering the risk of clutter as a result.
🔶 DETAILS
Birdies are derived from a circle that connects two Swing points. The left-wing curve originates from the most recent "Swing point" to the last value on the circle before crossing its midline. The mirror image of the left wing creates the right wing.
Enabling "Origine" will draw a line from the last Swing to the first.
🔹 Style
The publication includes a style setting with four options.
The first, "Birdy," shows a bird-like shape derived from a circle connecting the last Swing High and Swing Low.
The second option holds everything from the first option but connects both wingtips, providing potential horizontal levels of interest.
When setting "Birdy" to "None", the visual breakout signals will not defer from previous settings, but the focus is shifted towards the fill color, which can help detect potential trend shift.
A fourth setting, "Left Wing", will only show the left part of the "Birdy" pattern, removing the right part from the equation. This will change the visual breakout signals, providing alternative signals.
🔶 SETTINGS
Swing Length: The period used for swing detection, with higher values returning longer-term Swing Levels.
🔹 Validation
Minimum X-Distance: The minimum amount of bars between subsequent Swings
Minimum Y-Distance: The minimum amount of bars between subsequent Swings
Buffer (Multiple of ATR)
🔹 Style
Bullish Patterns: Enable / color
Bearish Patterns: Enable / color
Buffer Zone: Show / Color
Color Fill: Show color fill between two Birdies (if available)
Origine: Show the line between both Swing Points
🔹 Calculation
Calculated Bars: Allows the usage of fewer bars for performance/speed improvement
Indicator

D-Shape Breakout Signals [LuxAlgo]The D-Shape Breakout Signals indicator uses a unique and novel technique to provide support/resistance curves, a trailing stop loss line, and visual breakout signals from semi-circular shapes.
🔶 USAGE
D-shape is a new concept where the distance between two Swing points is used to create a semi-circle/arc, where the width is expressed as a user-defined percentage of the radius. The resulting arc can be used as a potential support/resistance as well as a source of breakouts.
Users can adjust this percentage (width of the D-shape) in the settings ( "D-Width" ), which will influence breakouts and the Stop-Loss line.
🔹 Breakouts of D-Shape
The arc of this D-shape is used for detecting breakout signals between the price and the curve. Only one breakout per D-shape can occur.
A breakout is highlighted with a colored dot, signifying its location, with a green dot being used when the top part of the arc is exceeded, and red when the bottom part of the arc is surpassed.
When the price reaches the right side of the arc without breaking the arc top/bottom, a blue-colored dot is highlighted, signaling a "Neutral Breakout".
🔹 Trailing Stop-Loss Line
The script includes a Trailing Stop-Loss line (TSL), which is only updated when a breakout of the D-Shape occurs. The TSL will return the midline of the D-Shape subject to a breakout.
The TSL can be used as a stop-loss or entry-level but can also act as a potential support/resistance level or trend visualization.
🔶 DETAILS
A D-shape will initially be colored green when a Swing Low is followed by a Swing High, and red when a Swing Low is followed by a Swing High.
A breakout of the upper side of the D-shape will always update the color to green or to red when the breakout occurs in the lower part. A Neutral Breakout will result in a blue-colored D-shape. The transparency is lowered in the event of a breakout.
In the event of a D-shape breakout, the shape will be removed when the total number of visible D-Shapes exceeds the user set "Minimum Patterns" setting. Any D-shape whose boundaries have not been exceeded (and therefore still active) will remain visible.
🔹 Trailing Stop-Loss Line
Only when a breakout occurs will the midline of the D-shape closest to the closing price potentially become the new Trailing Stop value.
The script will only consider middle lines below the closing price on an upward breakout or middle lines above the closing price when it concerns a downward breakout.
In an uptrend, with an already available green TSL, the potential new Stop-Loss value must be higher than the previous TSL value; while in a downtrend, the new TSL value must be lower.
The Stop-Loss line won't be updated when a "Neutral Breakout" occurs.
🔶 SETTINGS
Swing Length: Period used for the swing detection, with higher values returning longer-term Swing Levels.
🔹 D-Patterns
Minimum Patterns: Minimum amount of visible D-Shape patterns.
D-Width: Width of the D-Shape as a percentage of the distance between both Swing Points.
Included Swings: Include "Swing High" (followed by a Swing Low), "Swing Low" (followed by a Swing High), or "Both"
Style Historical Patterns: Show the "Arc", "Midline" or "Both" of historical patterns.
🔹 Style
Label Size/Colors
Connecting Swing Level: Shows a line connecting the first Swing Point.
Color Fill: colorfill of Trailing Stop-Loss
Indicator

FunctionGenerateRandomPointsInShapeLibrary "FunctionGenerateRandomPointsInShape"
Generate random vector points in geometric shape (parallelogram, triangle)
random_parallelogram(vector_a, vector_b) Generate random vector point in a parallelogram shape.
Parameters:
vector_a : float array, vector of (x, y) shape.
vector_b : float array, vector of (x, y) shape.
Returns: float array, vector of (x, y) shape.
random_triangle(vector_a, vector_b) Generate random vector point in a triangle shape.
Parameters:
vector_a : float array, vector of (x, y) shape.
vector_b : float array, vector of (x, y) shape.
Returns: float array, vector of (x, y) shape. Library

Indicator

Periodic EllipsesThe following script periodically plot ellipses to the chart, where the maximum height of the ellipses is determined by the price high of the user-selected time frame while the price low determines the minimum height of the ellipses.
The selected time frame affects the frequency at which the ellipses are plotted, for example, a selected time frame of 1 week will plot an ellipse every week
Note that time frames that are close to the one used in the main chart can return noncircular shapes
Here the main time frame is 15 minutes, while the time frame in the script is 1 hour.
By default the script uses future data, and as such repaint which makes it only useful in offline (non-real time) situations, you can make the script use only past data by deselecting the "repaint" option.
Interpretation And Construction
In terms of usages and interpretation ellipses are similar to bands indicators, as such we can use ellipses in a breakout methodology, where a closing price crossing over the upper bound indicating an uptrend and a closing price crossing under the lower bound indicating a downtrend.
By default, the color of the plots are based on a gradient determined by the position of the closing price relative to the ellipse, with a closing price closer to the upper bound of the ellipse returning a blue color and a closing price closer to the lower bound returning a red color, the intermediate color is violet. When repainting mode is deactivated a blue color indicates an up-trend, while a red color indicates a down-trend, violet colors on the other hand indicate a ranging market.
The ellipses can also determine possible retracements, as such the upper bound of the ellipse can act as a support in an uptrend while the lower bound can act as a resistance in a downtrend.
Construction
Peoples might be interested in the construction of ellipses, this task is not complicated. We can construct circular shapes by using the equation of a semi-circle described as follows:
C = √(1 - x*x)
with 1 ≥ x ≥ -1 , values of x greater than 1 or lower than -1 will return na . In the script, the variable basis creates a line starting at -1 and ending at 1, we then only need to apply the previous equation to this line to have a semi-circle. This semi-circle is in a range of (0,1), so we need to rescale it in a useful range, let's define the highest high of the selected time frame as H and the lowest low as L , the upper and lower bound of the ellipse are calculated as follows:
upper = avg(H,L) + C*(H - avg(H,L))
lower = avg(H,L) - C*(avg(H,L) - L)
Summary
A script plotting ellipses has been proposed, we have seen that the signals that can be generated are similar to the one generated by band indicators, note however that the script has not been made to be a serious indicator, it would be more advisable to use regular band indicators instead.
Thx to @freds_view for the question.
Indicator

Indicator

Fractal BreakoutFirst of all, huge credit to synapticEx , whose brilliant use of the security function inspired me to figure out a way to get quasi-shape boundaries automatically drawn on a chart.
This study draws upper and lower trend lines, based on configurable fractal*** reversal detection, calculates slope from the last two upper or lower reversal points, and then extends a dotted line along the same slope...until the next upper (or lower) reversal occurs. If the high (or low) breaks this extension, the dotted line becomes solid to aid visibility. Reversal detection is configurable to use any number of ticks, but probably four to eight will work best.
I made the inclusion of volume in the reversal logic optional (off by default) and left the existing SMA input found in synapticEx's code intact, albeit with a lower default. With the addition of trend lines, I found volume hindered identification of reversals, although I could try various other filters than the SMA included originally.
I have also left intact the very nice ability to change the period and use the requested period identify reversals, courtesy of synapticEx.
This could be used in a strategy, as the values plotted are actual values that are available to include in logic and do not include knowledge of the future. However , information is not available until the floor of half the number of ticks used in reversal detection (I then offset by that number to line things up visually). Having never heard of it until now, I just Googled the Bill Williams Alligator strategy, which looks interesting, so maybe I could see how this could be ported to that.
***As I typed this, I remembered that while making reversal detection configurable, I changed the detection logic simply to look for highest (or lowest) of the desired length of ticks. I don't know whether this is not strictly fractal anymore, but if desired, with a little work, I could make it require consecutive, consistent changes before and after each reversal again.
Here are a few screenshots from hourly ticks, using the "current" (hourly) period, with and without volume, and playing with the number of points used to identify reversals.
Not using volume
Using volume
Indicator

Indicator
