SA_ORB_ONR_CLOUD_vwapBandsSIGNAL ARCHITECT™ — ORB / ONR Cloud with VWAP Bands
Optimized for the 15-Minute Timeframe
Overview
The Signal Architect™ ORB / ONR Cloud is a session-structure and probability framework designed to help traders understand where price is statistically compressed, transitioning, or escaping value during the regular trading session.
On the 15-minute chart, this study excels at identifying:
High-probability consolidation zones
Early session directional intent
Fade vs continuation environments
Context for VWAP-based mean reversion or trend extension
Rather than predicting price, the indicator classifies market behavior using time-anchored ranges and volume-weighted statistics.
Core Components (15-Minute Context)
1️⃣ Overnight Range (ONR)
The Overnight Range captures price extremes formed before the regular session opens.
On the 15-minute timeframe, ONR acts as:
A higher-timeframe reference level
A source of institutional liquidity memory
A boundary where early session reactions often occur
2️⃣ Opening Range (ORB)
The Opening Range is defined as the first X minutes after the session open (default: 15 minutes).
On a 15-minute chart:
The ORB often forms entirely within a single candle
It represents initial institutional positioning
It helps differentiate initiative vs responsive behavior
3️⃣ ORB–ONR Cloud (Key Feature)
The Cloud is the overlapping area between the Overnight Range and the Opening Range.
This zone is critical on the 15-minute timeframe because it often represents:
Compressed auction
Balance / indecision
Liquidity absorption
Interpretation:
Price inside the cloud → Higher probability of consolidation, fade, or contraction
Price exiting the cloud → Transition toward expansion or trend resolution
The cloud is not a signal — it is a probability environment.
4️⃣ VWAP with Session-Weighted σ Bands
The study plots VWAP starting from the regular session open, along with true volume-weighted standard deviation bands (±1σ, ±2σ).
On the 15-minute timeframe:
VWAP defines fair value
σ bands help distinguish normal rotation vs statistical extension
Interaction with VWAP while inside the cloud often suggests mean-reverting conditions
Interaction with VWAP after leaving the cloud often confirms trend continuation
5️⃣ Breakout Classification (BRK)
A BRK event occurs when price closes outside BOTH:
The Overnight Range
The Opening Range
On the 15-minute chart:
BRK events often mark session regime changes
They are contextual markers, not entries
Arrows are color-matched to the candle (green candle → green arrow, red candle → red arrow)
To avoid clutter, breakouts can be limited to first-occurrence only.
Probability Layer (15-Minute Edge)
The indicator includes rolling probability calculations to quantify market behavior:
📊 Inside-Cloud Probability
Shows how often price remains inside the ORB–ONR cloud over the selected lookback.
Higher values → balance / compression dominant
Lower values → trend / expansion dominant
📉 Fade / Contraction Probability (Inside Cloud)
When price is inside the cloud, the study measures volatility contraction using ATR behavior.
Higher contraction % → Greater likelihood of rotation or fade
Lower contraction % → Cloud acting as launchpad rather than balance
📈 State Occupancy (5-State Model)
Tracks how price distributes its time across:
Above both ranges
Below both ranges
Inside ORB only
Inside ONR only
Inside the Cloud
This helps traders understand where the market statistically prefers to trade on the 15-minute structure.
Best Use Cases (15-Minute Chart)
✔ Contextual bias for intraday swing trades
✔ Identifying fade vs trend conditions
✔ VWAP-based execution alignment
✔ Avoiding low-probability entries inside compression
✔ Session structure awareness without lower-timeframe noise
What This Indicator Is NOT
❌ Not a buy/sell system
❌ Not predictive
❌ Not a guarantee of outcomes
It is a market structure and probability framework — designed to improve decision quality, not replace risk management.
Recommended Settings (15-Minute)
ORB Length: 15 minutes
VWAP Bands: ±1σ / ±2σ
Probability Lookback: 100–200 bars
Breakout Mode: First-occurrence only
Cloud Enabled: Yes
Risk & Compliance Notice
This tool is provided for educational and informational purposes only.
It does not constitute financial advice, investment recommendations, or trade instructions.
All trading involves risk, including the possible loss of capital.
Standalone Signal - trianchor.gumroad.com
chatgpt.com
chatgpt.com
chatgpt.com
Penunjuk dan strategi
Disaster SL & TP by refhowto set disaster stoploss according to asr, also eases position sizing to your depo level
Crypto Session Range 📄 INDICATOR DESCRIPTION (ENGLISH)
Crypto Session Range (Custom Timezone) is a lightweight and accurate session-based indicator designed specifically for cryptocurrency markets (24/7).
This indicator allows traders to define custom trading time windows using any global timezone, solving common issues found in traditional session indicators that are built for stock markets.
🔹 Key Features
Custom timezone support (e.g. America/Puerto_Rico, America/New_York, UTC)
Up to 3 configurable trading sessions
Visual background highlighting during active sessions
Automatic High & Low range tracking for each session
Optional range extension after the session ends
Works on all crypto pairs and timeframes
🔹 Who Is This For?
Crypto traders who want precise session control
Day traders, scalpers, and session-based strategies
Traders who operate during specific market windows (London / NY / custom)
🔹 Notes
This indicator is not restricted to exchange trading hours and is fully compatible with 24/7 markets like crypto, unlike many default session tools.
Trap longs - Hamza Naveed// This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
//@version=5
indicator("Trap Longs - Hamza Naveed", max_labels_count = 500, overlay = false, format = format.volume)
g1 = '📊 Net Positions '
g2 = '📈 Moving Averages (VWMA/EMA) '
g3 = '⚙️ Additional Settings '
g4 = '🎚️ Profile '
g5 = '🖥️ Statistics '
g6 = '⚖️ Divergences'
// User inputs - General settings
dtype = input.string('Net Positions', 'Type', options = )
disp = input.string('Candles', 'Display as', options = )
cumu = input.string('Full Data', 'Cumulation', options = )
denom = input.string('Quote Currency', 'Quoted in', options = )
// User inputs - Data Source Settings
binance = input.bool(true, 'Binance USDT.P', inline = 'src')
binance2 = input.bool(true, 'Binance USD.P', inline = 'src')
binance3 = input.bool(true, 'Binance BUSD.P', inline = 'src2')
bitmex = input.bool(true, 'BitMEX USD.P', inline = 'src2')
bitmex2 = input.bool(true, 'BitMEX USDT.P ', inline = 'src3')
kraken = input.bool(true, 'Kraken USD.P', inline = 'src3')
// User inputs - Net Positions
showL = input.bool(true, 'NET LONGS ►', group = g1, inline='l')
showS = input.bool(false, 'NET SHORTS ►', group = g1, inline='s')
showD = input.bool(false, 'NET DELTA ►', group = g1, inline='d')
showR = input.bool(false, 'NET RATIO ►', group = g1, inline='r')
pcolL = input.color(#a5d6a7, '', group = g1, inline = 'l')
ncolL = input.color(#f77c80, '', group = g1, inline = 'l')
lcolL = input.color(#a5d6a7, '━', group = g1, inline = 'l')
pcolS = input.color(#a5d6a7, '', group = g1, inline = 's')
ncolS = input.color(#f77c80, '', group = g1, inline = 's')
lcolS = input.color(#faa1a4, '━', group = g1, inline = 's')
pcolD = input.color(#a5d6a7, '', group = g1, inline = 'd')
ncolD = input.color(#f77c80, '', group = g1, inline = 'd')
lcolD = input.color(#90bff9, '━', group = g1, inline = 'd')
pcolR = input.color(#a5d6a7, '', group = g1, inline = 'r')
ncolR = input.color(#f77c80, '', group = g1, inline = 'r')
lcolR = input.color(#f9d690, '━', group = g1, inline = 'r')
// User inputs - Net Positions EMAs
mat = input.string('VWMA', 'Type', options= , group=g2)
emaL = input.bool(false, 'LONGS ', group=g2, inline='emal')
emaS = input.bool(false, 'SHORTS ', group=g2, inline='emas')
emaD = input.bool(false, 'DELTA ',group=g2, inline='emad')
emaR = input.bool(false, 'RATIO ',group=g2, inline='emar')
emaLl = input.int(100, '', group=g2, inline='emal')
emaSl = input.int(100, '', group=g2, inline='emas')
emaDl = input.int(100, '', group=g2, inline='emad')
emaRl = input.int(100, '', group=g2, inline='emar')
emaLc = input.color(color.rgb(165, 214, 167, 60), '', group=g2, inline='emal')
emaSc = input.color(color.rgb(250, 161, 164, 60), '', group=g2, inline='emas')
emaDc = input.color(color.rgb(144, 191, 249, 60), '', group=g2, inline='emad')
emaRc = input.color(color.rgb(249, 214, 144, 60), '', group=g2, inline='emar')
// User inputs - Additional settings
volhm = input.bool(false, 'Volume HM', group=g3, inline='vol')
volc2 = input.color(color.rgb(49, 121, 245),'', group=g3, inline = 'vol')
offs = input.int (10, 'Label Offset', group=g3)
length = input.int (14, 'Position RSI Length', group=g3)
vlbl = input.bool(true, 'Value Labels', group=g3, inline='lv')
nlbl = input.bool(true, 'Data Labels', group=g3, inline='lv')
wick = input.bool(false, 'Show Candle Wicks', group=g3)
// User inputs - Profile settings
prof = input.bool (false, 'Generate a profile', group=g4)
profsrc = input.string('Net Longs', 'Profile Data', options = , group=g4)
vapct = input.float (70, 'Value Area %', minval = 5, maxval = 95, group = g4)
ori = input.string("Left", 'Position', options = , group = g4)
profSize = input.int (2, 'Node Size', minval = 1, group = g4)
rows = input.int (40, 'Rows', minval = 6, maxval = 500, step = 25, group = g4) - 1
vancol = input.color (color.new(color.blue, 75), 'Node Colors ', group = g4, inline = 'nc')
nvancol = input.color (color.new(color.gray, 75), '━', group = g4, inline = 'nc')
poc = input.bool (false, 'POC', group = g4, inline = 'POC'),
poccol = input.color (color.new(color.red, 50), ' ', group = g4, inline = "POC")
val = input.bool (false, 'VA', group = g4, inline = "VA")
vafill = input.color (color.new(color.blue, 95), ' ', group = g4, inline = 'VA')
// User inputs - Statistics
stats = input.bool(false, 'Show Stats', group = g5)
chg_b = input.int(50, 'Bars Back', group = g5)
tablevpos = input.string('Horizontal', 'Orientation', options= , group = g5)
tablepos = input.string('Bottom Center', 'Position', options= , group = g5)
stat_oi = input.bool(true, 'OI ━', group = g5, inline = 'oi')
stat_nl = input.bool(true, 'NL ━', group = g5, inline = 'nl')
stat_ns = input.bool(true, 'NS ━', group = g5, inline = 'ns')
stat_nd = input.bool(true, 'ND ━', group = g5, inline = 'nd')
stat_oi_c = input.bool(true, 'OI Change ━', group = g5, inline = 'oi')
stat_nl_c = input.bool(true, 'NL Change ━', group = g5, inline = 'nl')
stat_ns_c = input.bool(true, 'NS Change ━', group = g5, inline = 'ns')
stat_nd_c = input.bool(true, 'ND Change ━', group = g5, inline = 'nd')
stat_oi_r = input.bool(true, 'OI RSI', group = g5, inline = 'oi')
stat_nl_r = input.bool(true, 'NL RSI', group = g5, inline = 'nl')
stat_ns_r = input.bool(true, 'NS RSI', group = g5, inline = 'ns')
stat_nd_r = input.bool(true, 'ND RSI', group = g5, inline = 'nd')
// User inputs - Divergence Finder
showdiv = input.bool(false, 'Divergence finder', group = g6)
divsrc = input.string('Net Longs', 'Source', options = , group=g6)
pivotDistance = input.int(5, 'Maximum Distance', minval=0, group=g6)
leftPivot = input.int(8, 'Lookback Bars Left', minval=1, group=g6)
rightPivot = input.int(8, 'Lookback Bars Right', minval=1, group=g6)
pHH_npLH = input.bool(true, 'Price HH + Data LH', group = g6, inline='div1')
pLH_npHH = input.bool(true, 'Price LH + Data HH', group = g6, inline='div2')
pLL_npHL = input.bool(true, 'Price LL + Data HL ', group = g6, inline='div3')
pHL_npLL = input.bool(true, 'Price HL + Data LL ', group = g6, inline='div4')
pHH_npLHcol = input.color(color.red, '', group = g6, inline='div1')
pLH_npHHcol = input.color(color.red, '', group = g6, inline='div2')
pLL_npHLcol = input.color(color.green, '', group = g6, inline='div3')
pHL_npLLcol = input.color(color.green, '', group = g6, inline='div4')
// Getting OI data
mex = syminfo.basecurrency=='BTC' ? 'XBT' : string(syminfo.basecurrency)
= request.security('BINANCE' + ":" + string(syminfo.basecurrency) + 'USDT.P_OI', timeframe.period, [close-close , close], ignore_invalid_symbol = true)
= request.security('BINANCE' + ":" + string(syminfo.basecurrency) + 'USD.P_OI', timeframe.period, [close-close , close], ignore_invalid_symbol = true)
= request.security('BINANCE' + ":" + string(syminfo.basecurrency) + 'BUSD.P_OI', timeframe.period, [close-close , close], ignore_invalid_symbol = true)
= request.security('BITMEX' + ":" + mex + 'USD.P_OI', timeframe.period, [close-close , close], ignore_invalid_symbol = true)
= request.security('BITMEX' + ":" + mex + 'USDT.P_OI', timeframe.period, [close-close , close], ignore_invalid_symbol = true)
= request.security('KRAKEN' + ":" + string(syminfo.basecurrency) + 'USD.P_OI', timeframe.period, [close-close , close], ignore_invalid_symbol = true)
deltaOI = (binance ? nz(oid1,0) : 0) + (binance2 ? nz(oid2,0)/close : 0) + (binance3 ? nz(oid3,0) : 0) + (bitmex ? nz(oid4,0)/close : 0) + (bitmex2 ? nz(oid5,0)/close : 0) + (kraken ? nz(oid6,0)/close : 0)
OI = (binance ? nz(oi1,0) : 0) + (binance2 ? nz(oi2,0)/close : 0) + (binance3 ? nz(oi3,0) : 0) + (bitmex ? nz(oi4,0)/close : 0) + (bitmex2 ? nz(oi5,0)/close : 0) + (kraken ? nz(oi6,0)/close : 0)
// Conditions for positions entering and exiting
priceUP = close>open
priceDOWN = close0
oiDOWN = deltaOI<0
newlongs = oiUP and priceUP
rektlongs = oiDOWN and priceDOWN
newshorts = oiUP and priceDOWN
rektshorts = oiDOWN and priceUP
// Visible range
vrc = cumu=='Visible Range' ? time > chart.left_visible_bar_time and time <= chart.right_visible_bar_time : true
// Cumulation of positions entering and exiting
longs_entering = ta.cum(newlongs and vrc ? (denom=='Base Currency' ? deltaOI : deltaOI * close) : 0)
longs_exiting = ta.cum(rektlongs and vrc ? (denom=='Base Currency' ? deltaOI : deltaOI * close) : 0)
shorts_entering = ta.cum(newshorts and vrc ? (denom=='Base Currency' ? deltaOI : deltaOI * close) : 0)
shorts_exiting = ta.cum(rektshorts and vrc ? (denom=='Base Currency' ? deltaOI : deltaOI * close) : 0)
// Output data
net_longs = longs_entering - math.abs(longs_exiting)
net_shorts = shorts_entering - math.abs(shorts_exiting)
net_delta = net_longs - net_shorts
net_ratio = net_longs / net_shorts
// Calculating Relative Strength
longs_strength = ta.rsi(net_longs, length)
shorts_strength = ta.rsi(net_shorts, length)
delta_strength = ta.rsi(net_delta, length)
ratio_strength = ta.rsi(net_ratio, length)
oi_strength = ta.rsi(OI, length)
// Calculating candle OHLC
src = dtype=='Net Positions' ? net_longs : longs_strength
OpenL = wick ? ta.sma(src , 2) : src
HighL = ta.highest(src, 1)
LowL = ta.lowest(src, 1)
CloseL = wick ? ta.sma(src, 2) : src
src2 = dtype=='Net Positions' ? net_shorts : shorts_strength
OpenS = wick ? ta.sma(src2 , 2) : src2
HighS = ta.highest(src2, 1)
LowS = ta.lowest(src2, 1)
CloseS = wick ? ta.sma(src2, 2) : src2
src3 = dtype=='Net Positions' ? net_delta : delta_strength
OpenD = wick ? ta.sma(src3 , 2) : src3
HighD = ta.highest(src3, 1)
LowD = ta.lowest(src3, 1)
CloseD = wick ? ta.sma(src3, 2) : src3
src4 = dtype=='Net Positions' ? net_ratio : ratio_strength
OpenR = wick ? ta.sma(src4 , 2) : src4
HighR = ta.highest(src4, 1)
LowR = ta.lowest(src4, 1)
CloseR = wick ? ta.sma(src4, 2) : src4
// Calculating EMAs
Lema = mat=='EMA' ? ta.ema(src, emaLl) : ta.vwma(src, emaLl)
Sema = mat=='EMA' ? ta.ema(src2, emaSl) : ta.vwma(src2, emaSl)
Dema = mat=='EMA' ? ta.ema(src3, emaDl) : ta.vwma(src3, emaDl)
Rema = mat=='EMA' ? ta.ema(src4, emaRl) : ta.vwma(src4, emaRl)
// Conditions
lcondL = showL and (disp=='Line' or disp=='Columns'), ccondL = showL and disp=='Candles'
lcondS = showS and (disp=='Line' or disp=='Columns'), ccondS = showS and disp=='Candles'
lcondD = showD and (disp=='Line' or disp=='Columns'), ccondD = showD and disp=='Candles'
lcondR = showR and (disp=='Line' or disp=='Columns'), ccondR = showR and disp=='Candles'
// Plotting Lines
plot(lcondL ? src : na, title="Net Longs", color=disp=='Line' ? lcolL : (net_longs >0 ? pcolL : ncolL), linewidth=1, style = disp=='Line' ? plot.style_line : disp=='Columns' ? plot.style_columns : na, editable = false)
plot(lcondS ? src2 : na, title="Net Shorts", color=disp=='Line' ? lcolS : (net_shorts >0 ? pcolS : ncolS), linewidth=1, style = disp=='Line' ? plot.style_line : disp=='Columns' ? plot.style_columns : na, editable = false)
plot(lcondD ? src3 : na, title="Net Shorts", color=disp=='Line' ? lcolD : (net_delta >0 ? pcolD : ncolD), linewidth=1, style = disp=='Line' ? plot.style_line : disp=='Columns' ? plot.style_columns : na, editable = false)
plot(lcondR ? src4 : na, title="Net Ratio", color=disp=='Line' ? lcolR : (net_ratio >0 ? pcolR : ncolR), linewidth=1, style = disp=='Line' ? plot.style_line : disp=='Columns' ? plot.style_columns : na, editable = false)
// Plotting Candles
plotcandle(ccondL ? OpenL : na, ccondL ? HighL : na, ccondL ? LowL : na, ccondL ? CloseL : na, "Longs", CloseL>OpenL ? pcolL : ncolL, CloseL>OpenL ? pcolL : ncolL, false, bordercolor = CloseL>OpenL ? pcolL : ncolL)
plotcandle(ccondS ? OpenS : na, ccondS ? HighS : na, ccondS ? LowS : na, ccondS ? CloseS : na, "Shorts", CloseS>OpenS ? pcolS : ncolS, CloseS>OpenS ? pcolS : ncolS, false, bordercolor = CloseS>OpenS ? pcolS : ncolS)
plotcandle(ccondD ? OpenD : na, ccondD ? HighD : na, ccondD ? LowD : na, ccondD ? CloseD : na, "Delta", CloseD>OpenD ? pcolD : ncolD, CloseD>OpenD ? pcolD : ncolD, false, bordercolor = CloseD>OpenD ? pcolD : ncolD)
plotcandle(ccondR ? OpenR : na, ccondR ? HighR : na, ccondR ? LowR : na, ccondR ? CloseR : na, "Ratio", CloseR>OpenR ? pcolR : ncolR, CloseR>OpenR ? pcolR : ncolR, false, bordercolor = CloseR>OpenR ? pcolR : ncolR)
// Plotting EMAs
plot(emaL ? Lema : na, color=emaLc, editable = false)
plot(emaS ? Sema : na, color=emaSc, editable = false)
plot(emaD ? Dema : na, color=emaDc, editable = false)
plot(emaR ? Rema : na, color=emaRc, editable = false)
// Plotting Relative Strength
plot(dtype=='Position RSI' ? 100 : na, color=color.rgb(120, 123, 134, 90), title = 'RSI 100')
plot(dtype=='Position RSI' ? 70 : na, color=color.rgb(120, 123, 134, 72), title = 'RSI 70')
plot(dtype=='Position RSI' ? 50 : na, color=color.rgb(120, 123, 134, 90), title = 'RSI 50')
plot(dtype=='Position RSI' ? 30 : na, color=color.rgb(120, 123, 134, 72), title = 'RSI 30')
plot(dtype=='Position RSI' ? 0 : na, color=color.rgb(120, 123, 134, 90), title = 'RSI 0')
// Volume Heatmap
vol = volume
volmax = ta.highest(volume, 50)
col = color.from_gradient(volume, 0, volmax, chart.bg_color, volc2)
plotshape(time>chart.left_visible_bar_time and volhm, style=shape.square, size=size.normal,location = location.bottom, color=col, editable = false)
// Labels
if vlbl and disp=='Candles'
vLlabel = showL ? label.new(bar_index, CloseL>OpenL ? HighL : LowL, newlongs or rektlongs ? str.tostring(deltaOI, format.volume) : na, size = size.auto, color=color.rgb(255, 255, 255, 100), textcolor = chart.fg_color, style = CloseL>OpenL ? label.style_label_down : label.style_label_up) : na
vSlabel = showS ? label.new(bar_index, CloseS>OpenS ? HighS : LowS, newshorts or rektshorts ? str.tostring(deltaOI, format.volume) : na, size = size.auto, color=color.rgb(255, 255, 255, 100), textcolor = chart.fg_color, style = CloseS>OpenS ? label.style_label_down : label.style_label_up) : na
vDlabel = showD ? label.new(bar_index, CloseD>OpenD ? HighD : LowD, str.tostring(deltaOI, format.volume), size = size.auto, color=color.rgb(255, 255, 255, 100), textcolor = chart.fg_color, style = CloseD>OpenD ? label.style_label_down : label.style_label_up) : na
vRlabel = showR ? label.new(bar_index, CloseR>OpenR ? HighR : LowR, str.tostring(deltaOI, format.volume), size = size.auto, color=color.rgb(255, 255, 255, 100), textcolor = chart.fg_color, style = CloseR>OpenR ? label.style_label_down : label.style_label_up) : na
if nlbl and disp!='Columns'
Llabel = showL ? label.new(bar_index+offs, src, 'NET LONGS', size = size.tiny, color=lcolL, textcolor = color.black, style = label.style_label_left) : na
Slabel = showS ? label.new(bar_index+offs, src2, 'NET SHORTS', size = size.tiny, color=lcolS, textcolor = color.black, style = label.style_label_left) : na
Dlabel = showD ? label.new(bar_index+offs, src3, 'NET DELTA', size = size.tiny, color=lcolD, textcolor = color.black, style = label.style_label_left) : na
Rlabel = showR ? label.new(bar_index+offs, src4, 'NET RATIO', size = size.tiny, color=lcolR, textcolor = color.black, style = label.style_label_left) : na
label.delete(Llabel )
label.delete(Slabel )
label.delete(Dlabel )
label.delete(Rlabel )
// Generating a profile - Code from @KioseffTrading's "Profile Any Indicator" script (used with their permission)
srcp = profsrc=='Net Longs' ? src : profsrc=='Net Shorts' ? src2 : profsrc=='Net Delta' ? src3 : src4
var int timeArray = array.new_int()
var float dist = array.new_float()
var int x2 = array.new_int(rows + 1, 5)
var vh = matrix.new(1, 1)
array.unshift(timeArray, math.round(time))
if prof and time >= chart.left_visible_bar_time and time <= chart.right_visible_bar_time
matrix.add_col(vh)
matrix.set(vh, 0, matrix.columns(vh) - 1, srcp)
if prof and barstate.islast
= switch ori
"Left" =>
=>
calc = (matrix.max(vh) - matrix.min(vh)) / (rows + 1)
for i = 0 to rows
array.push(dist, matrix.min(vh) + (i * calc))
for i = 1 to matrix.columns(vh) - 1
for x = 0 to array.size(dist) - 1
if matrix.get(vh, 0, i) >= matrix.get(vh, 0, i - 1)
if array.get(dist, x) >= matrix.get(vh, 0, i - 1) and array.get(dist, x) <= matrix.get(vh, 0, i)
array.set(x2, x, array.get(x2, x) + profSize)
else
if array.get(dist, x) >= matrix.get(vh, 0, i) and array.get(dist, x) <= matrix.get(vh, 0, i - 1)
array.set(x2, x, array.get(x2, x) + profSize)
boc = array.new_box()
for i = 1 to rows
right = array.get(timeArray, n + array.get(x2, i))
if ori == "Left"
switch math.sign(n - array.get(x2, i))
-1 => right := chart.right_visible_bar_time
=> right := array.get(timeArray, n - array.get(x2, i))
array.push(boc, box.new(pos, array.get(dist, i - 1),
right, array.get(dist, i), xloc = xloc.bar_time, border_color =
nvancol, bgcolor = nvancol
))
if i == rows
array.push(boc, box.new(pos, array.get(dist, array.size(dist) - 1),
right, array.get(dist, array.size(dist) - 1) + calc, xloc = xloc.bar_time, border_color =
nvancol, bgcolor = nvancol
))
array.shift(x2), nx = array.indexof(x2, array.max(x2))
nz = nx - 1, nz2 = 0, nz3 = 0, nz4 = 0
for i = 0 to array.size(x2) - 1
if nz > -1 and nx <= array.size(x2) - 1
switch array.get(x2, nx) >= array.get(x2, nz)
true => nz2 += array.get(x2, nx), nx += 1
=> nz2 += array.get(x2, nz), nz -= 1
else if nz <= -1
nz2 += array.get(x2, nx), nx += 1
else if nx >= array.size(x2)
nz2 += array.get(x2, nz), nz -= 1
if nz2 >= array.sum(x2) * (vapct / 100)
nz3 := nx <= array.size(x2) - 1 ? nx : array.size(x2) - 1, nz4 := nz <= -1 ? 0 : nz
break
for i = nz3 to nz4
box.set_border_color(array.get(boc, i), vancol)
box.set_bgcolor(array.get(boc, i), vancol)
if poc
var pocL = line(na)
y = math.avg(box.get_top(array.get(boc, array.indexof(x2, array.max(x2)))), box.get_bottom(array.get(boc, array.indexof(x2, array.max(x2)))))
if na(pocL)
pocL := line.new(chart.left_visible_bar_time, y, chart.right_visible_bar_time, y, xloc = xloc.bar_time, color = poccol, width = 1)
else
line.set_xy1(pocL, chart.left_visible_bar_time, y)
line.set_xy2(pocL, chart.right_visible_bar_time, y)
if val
var vaup = line(na), var vadn = line(na)
ydn = box.get_bottom(array.get(boc, nz3)), yup = box.get_top(array.get(boc, nz4))
if na(vaup)
vadn := line.new(chart.left_visible_bar_time, ydn, chart.right_visible_bar_time, ydn, xloc = xloc.bar_time, color = vancol, width = 1)
vaup := line.new(chart.left_visible_bar_time, yup, chart.right_visible_bar_time, yup, xloc = xloc.bar_time, color = vancol, width = 1)
else
line.set_xy1(vadn, chart.left_visible_bar_time, ydn), line.set_xy2(vadn, chart.right_visible_bar_time, ydn)
line.set_xy1(vaup, chart.left_visible_bar_time, yup), line.set_xy2(vaup, chart.right_visible_bar_time, yup)
linefill.new(vadn, vaup, vafill)
//Generating tables for Stats
switchpos(tablepos) =>
switch tablepos
'Top Left' => position.top_left
'Top Center' => position.top_center
'Top Right' => position.top_right
'Bottom Left' => position.bottom_left
'Bottom Center' => position.bottom_center
'Bottom right' => position.bottom_right
dataTable = table.new(switchpos(tablepos), columns=15, rows=15, bgcolor=color.rgb(120, 123, 134, 56))
fill_rows(cond, txt, c, r) =>
if cond
table.cell(table_id=dataTable, column = tablevpos=='Horizontal' ? c : 0, row = tablevpos=='Horizontal' ? 0 : r, text = txt, height=0, text_color=color.white, text_halign=text.align_center, text_valign= text.align_center)
if barstate.islast and stats and dtype!='Position RSI'
txt = ' •𝗢𝗜: ' + (denom=='Quote Currency' ? '$' : '') + str.tostring(denom=='Base Currency' ? OI : OI*close, format = format.volume) + ' ' + (denom=='Base Currency' ? str.tostring(string(syminfo.basecurrency)) : '')
txt2 = ' •𝗡𝗟: ' + (denom=='Quote Currency' ? '$' : '') + str.tostring(net_longs, format = format.volume) + ' ' + (denom=='Base Currency' ? str.tostring(string(syminfo.basecurrency)) : '')
txt3 = ' •𝗡𝗦: ' + (denom=='Quote Currency' ? '$' : '') + str.tostring(net_shorts, format = format.volume) + ' ' + (denom=='Base Currency' ? str.tostring(string(syminfo.basecurrency)) : '')
txt4 = ' •𝗡𝗗: ' + (denom=='Quote Currency' ? '$' : '') + str.tostring(net_delta, format = format.volume) + ' ' + (denom=='Base Currency' ? str.tostring(string(syminfo.basecurrency)) : '')
txt5 = ' •𝗢𝗜𝗖: ' + (denom=='Quote Currency' ? '$' : '') + str.tostring(denom=='Base Currency' ? OI-OI : (OI-OI ) * close, format = format.volume) + ' ' + (denom=='Base Currency' ? str.tostring(string(syminfo.basecurrency)) : '')
txt6 = ' •𝗡𝗟𝗖: ' + (denom=='Quote Currency' ? '$' : '') + str.tostring(net_longs - net_longs , format = format.volume) + ' ' + (denom=='Base Currency' ? str.tostring(string(syminfo.basecurrency)) : '')
txt7 = ' •𝗡𝗦𝗖: ' + (denom=='Quote Currency' ? '$' : '') + str.tostring(net_shorts - net_shorts , format = format.volume) + ' ' + (denom=='Base Currency' ? str.tostring(string(syminfo.basecurrency)) : '')
txt8 = ' •𝗡𝗗𝗖: ' + (denom=='Quote Currency' ? '$' : '') + str.tostring(net_delta - net_delta , format = format.volume) + ' ' + (denom=='Base Currency' ? str.tostring(string(syminfo.basecurrency)) : '')
txt9 = ' •𝗢𝗜 𝗥𝗦𝗜: ' + str.tostring(math.round(oi_strength,1))
txt10 = ' •𝗡𝗟 𝗥𝗦𝗜: ' + str.tostring(math.round(longs_strength,1))
txt11 = ' •𝗡𝗦 𝗥𝗦𝗜: ' + str.tostring(math.round(shorts_strength, 1))
txt12 = ' •𝗡𝗗 𝗥𝗦𝗜: ' + str.tostring(math.round(delta_strength, 1))
fill_rows(stat_oi, txt, 0, 0)
fill_rows(stat_nl, txt2, 1, 1)
fill_rows(stat_ns, txt3, 2, 2)
fill_rows(stat_nd, txt4, 3, 3)
fill_rows(stat_oi_c, txt5, 4, 4)
fill_rows(stat_nl_c, txt6, 5, 5)
fill_rows(stat_ns_c, txt7, 6, 6)
fill_rows(stat_nd_c, txt8, 7, 7)
fill_rows(stat_oi_r, txt9, 8, 8)
fill_rows(stat_nl_r, txt10, 9, 9)
fill_rows(stat_ns_r, txt11, 10, 10)
fill_rows(stat_nd_r, txt12, 11, 11)
// Divergence Finder
switchdivsrc(divsrc) =>
switch divsrc
'Net Longs' => src
'Net Shorts' => src2
'Net Delta' => src3
'Net Ratio' => src4
np = switchdivsrc(divsrc)
var priceHigh = array.new_float(0), var priceLow = array.new_float(0)
var priceHighIndex = array.new_int (0), var priceLowIndex = array.new_int (0)
var npHigh = array.new_float(0), var npLow = array.new_float(0)
var npHighIndex = array.new_int (0), var npLowIndex = array.new_int (0)
var priceHighTrend = 0, var priceLowTrend = 0
var npHighTrend = 0, var npLowTrend = 0
bool closeRecentHighs = false, bool closeOldHighs = false
bool closeHighs = false, bool closeRecentLows = false
bool closeOldLows = false, bool closeLows = false
curPriceHigh = ta.pivothigh(close, leftPivot, rightPivot)
curPriceLow = ta.pivotlow (close, leftPivot, rightPivot)
curnpHigh = ta.pivothigh(np, leftPivot, rightPivot)
curnpLow = ta.pivotlow (np, leftPivot, rightPivot)
if not na(curPriceHigh)
array.push(priceHigh, curPriceHigh)
array.push(priceHighIndex, bar_index-rightPivot)
if not na(curPriceLow)
array.push(priceLow, curPriceLow)
array.push(priceLowIndex, bar_index-rightPivot)
if not na(curnpHigh)
array.push(npHigh, curnpHigh)
array.push(npHighIndex, bar_index-rightPivot)
if not na(curnpLow)
array.push(npLow, curnpLow)
array.push(npLowIndex, bar_index-rightPivot)
if showdiv
if array.size(priceHigh) >= 2 and not na(curPriceHigh)
if array.get(priceHigh, array.size(priceHigh)-1) >= array.get(priceHigh, array.size(priceHigh)-2)
priceHighTrend := 1
else
priceHighTrend := -1
if array.size(priceLow) >= 2 and not na(curPriceLow)
if array.get(priceLow, array.size(priceLow)-1) >= array.get(priceLow, array.size(priceLow)-2)
priceLowTrend := 1
else
priceLowTrend := -1
if array.size(npHigh) >= 2 and not na(curnpHigh)
if array.get(npHigh, array.size(npHigh)-1) >= array.get(npHigh, array.size(npHigh)-2)
npHighTrend := 1
else
npHighTrend := -1
if array.size(npLow) >= 2 and not na(curnpLow)
if array.get(npLow, array.size(npLow)-1) >= array.get(npLow, array.size(npLow)-2)
npLowTrend := 1
else
npLowTrend := -1
if array.size(priceHighIndex) >= 2 and array.size(npHighIndex) >=2
closeRecentHighs := math.abs(array.get(priceHighIndex, array.size(priceHighIndex)-1) - array.get(npHighIndex, array.size(npHighIndex)-1)) <= pivotDistance
closeOldHighs := math.abs(array.get(priceHighIndex, array.size(priceHighIndex)-2) - array.get(npHighIndex, array.size(npHighIndex)-2)) <= pivotDistance
closeHighs := closeRecentHighs and closeOldHighs
if array.size(priceLowIndex) >= 2 and array.size(npLowIndex) >=2
closeRecentLows := math.abs(array.get(priceLowIndex, array.size(priceLowIndex)-1) - array.get(npLowIndex, array.size(npLowIndex)-1)) <= pivotDistance
closeOldLows := math.abs(array.get(priceLowIndex, array.size(priceLowIndex)-2) - array.get(npLowIndex, array.size(npLowIndex)-2)) <= pivotDistance
closeLows := closeRecentLows and closeOldLows
bool uptrendExhuastion = closeHighs and priceHighTrend > 0 and npHighTrend < 0 and (not na(curnpHigh) or not na(curPriceHigh))
bool uptrendAbsorption = closeHighs and priceHighTrend < 0 and npHighTrend > 0 and (not na(curnpHigh) or not na(curPriceHigh))
bool downtrendExhuastion = closeLows and priceLowTrend < 0 and npLowTrend > 0 and (not na(curnpLow) or not na(curPriceLow))
bool downtrendAbsorption = closeLows and priceLowTrend > 0 and npLowTrend < 0 and (not na(curnpLow) or not na(curPriceLow))
drawDiv(time1, price1, time2, price2, type) =>
dcol = type == 'Uptrend Exhuastion' ? pHH_npLHcol : type == 'Uptrend Absorption' ? pLH_npHHcol : type == 'Downtrend Exhaustion' ? pLL_npHLcol : type == 'Downtrend Absorption' ? pHL_npLLcol : na
line.new(x1=time1, y1=price1, x2=time2, y2=price2, color=dcol, width=1)
if uptrendAbsorption or uptrendExhuastion and showdiv
highTime1 = array.get(npHighIndex, array.size(npHighIndex)-1)
highPrice1 = array.get(npHigh, array.size(npHigh)-1)
highTime2 = array.get(npHighIndex, array.size(npHighIndex)-2)
highPrice2 = array.get(npHigh, array.size(npHigh)-2)
if uptrendExhuastion and pHH_npLH
drawDiv(highTime1, highPrice1, highTime2, highPrice2, 'Uptrend Exhuastion')
if uptrendAbsorption and pLH_npHH
drawDiv(highTime1, highPrice1, highTime2, highPrice2, 'Uptrend Absorption')
if downtrendAbsorption or downtrendExhuastion and showdiv
lowTime1 = array.get(npLowIndex, array.size(npLowIndex)-1)
lowPrice1 = array.get(npLow, array.size(npLow)-1)
lowTime2 = array.get(npLowIndex, array.size(npLowIndex)-2)
lowPrice2 = array.get(npLow, array.size(npLow)-2)
if downtrendExhuastion and pLL_npHL
drawDiv(lowTime1, lowPrice1, lowTime2, lowPrice2, 'Downtrend Exhuastion')
if downtrendAbsorption and pHL_npLL
drawDiv(lowTime1, lowPrice1, lowTime2, lowPrice2, 'Downtrend Absorption')
HVMTRIGGERS
This uses INTRADAY price action to find triggers where retail traders are trapped and milked for liquidity
Kalman Absorption/Distribution Tracker 3-State EKFQuant-Grade Institutional Flow: 3-State EKF Absorption Tracker
SUMMARY
An advanced, open-source implementation of a 3-State Extended Kalman Filter (EKF) designed to track institutional Order Flow. By analyzing 1-second intrabar microstructure data, this script estimates the true Position, Velocity, and Volatility of the Cumulative Volume Delta (CVD), revealing hidden Absorption and Distribution events in real-time.
INTRODUCTION: THE SIGNAL AMIDST THE NOISE
In the world of technical analysis, noise is the enemy. Traditional indicators rely on Moving Averages (SMA, EMA) to smooth out price and volume data. The problem is the "Lag vs. Noise" paradox: to get a smooth signal, you must accept lag; to get a fast signal, you must accept noise.
This indicator solves that paradox by introducing aerospace-grade mathematics to the TradingView community: The 3-State Extended Kalman Filter (EKF).
Unlike moving averages that blindly average past data, a Kalman Filter is a probabilistic state-space model. It constantly predicts where the order flow "should" be, compares it to the actual measurement, and updates its internal model based on the calculated uncertainty of the market.
This script is not just another volume oscillator. It is a full microstructure analysis engine that digests intrabar data (down to 1-second resolution) to track the true intent of "Smart Money" while filtering out the noise of retail chop.
THE INNOVATION: WHY 3 STATES?
Most Kalman Filters found in public libraries are "1-State" (tracking price only) or occasionally "2-State" (tracking price and velocity). This script introduces a highly advanced 3-State EKF.
The filter tracks three distinct variables simultaneously in a feedback loop:
State 1: Position (The True CVD)
This is the noise-filtered estimate of the Cumulative Volume Delta. It represents the actual inventory accumulation of aggressive buyers versus sellers, stripped of random noise.
State 2: Velocity (The Momentum)
This tracks the rate of change of the order flow. Is buying accelerating? Is selling pressure fading even as price drops? This provides a leading signal before the cumulative value even turns.
State 3: Volatility (The Adaptive Regime)
This is the game-changer. The filter estimates the current volatility of the order flow (Log-Volatility). In high-volatility environments (like news events), the filter automatically widens its uncertainty bands (Covariance) and reacts faster. In low-volatility environments (chop), it tightens up and ignores minor fluctuations.
THE LOGIC: DETECTING ABSORPTION AND DISTRIBUTION
The core philosophy of this indicator is based on Wyckoff Logic: Effort vs. Result.
-- Effort: Represented by the CVD (Buying/Selling pressure).
-- Result: Represented by Price Movement.
When these two diverge, we have an actionable signal. The script uses the EKF Velocity state to detect these moments:
Absorption (Bullish)
This occurs when the EKF detects high negative Velocity (aggressive selling), but Price refuses to drop. The "Smart Money" is absorbing the sell orders via limit buys. The indicator highlights this as a Blue Event in the dashboard.
Distribution (Bearish)
This occurs when the EKF detects high positive Velocity (aggressive buying), but Price refuses to rise. Limit sellers are capping the market. The indicator highlights this as an Orange Event.
TECHNICAL DEEP DIVE: UNDER THE HOOD
For the developers and quants, here is how the Pine Script is architected using the "type" and "method" features of Pine Script v5.
1. Data Ingestion (Microstructure)
The script uses "request.security_lower_tf" to pull intrabar data regardless of your chart timeframe. This allows the script to see "inside" the bar. A 5-minute candle might look green, but the microstructure might reveal that 80% of the volume was selling absorption at the wick. This script sees that.
2. Tick Classification
Standard CVD assumes that if Price Close is greater than Price Open, all volume is buying. This is often flawed. This script offers three modes of tick handling, including a "High-Low Distribution" method that statistically apportions volume based on where the tick closed relative to its high and low.
3. The EKF Mathematics
The script implements the standard Extended Kalman Filter equations manually. It calculates the Jacobian matrix to handle the non-linear relationship between volatility and price. The "Process Noise Matrix" (Q) is dynamically scaled by the Volatility State. This means the mathematics of the indicator literally "breathe" with the market conditions—expanding during expansion and contracting during consolidation.
THE DASHBOARD & VISUALS:
The indicator features a professional-grade HUD (Heads Up Display) located on the chart table.
-- EKF State Vector: Displays the real-time Position, Velocity, and Volatility values derived from the matrix.
-- Ease of Movement (Wyckoff): Calculates how much price moves per 1,000 contracts of CVD. For example, if Price moves +5 points per 1k Buy CVD, but only -2 points per 1k Sell CVD, the "Path of Least Resistance" is clearly UP.
-- Session State: Tracks cumulative confirmed Bullish vs. Bearish events for Today, Yesterday, and the Day Before (3-Day Profile).
-- Bias Summary: An algorithmic conclusion telling you if the day is "Confirmed Bullish," "Accumulating," or "Neutral."
HOW TO TRADE THIS INDICATOR
Strategy A: The Reversal (Absorption Play)
Look for price making a Lower Low.
Look for the EKF Velocity (Histogram) to be Deep Red (High Selling Pressure).
Watch the Dashboard "Absorption" count increase.
SIGNAL: When EKF Velocity crosses back toward zero and turns grey/green, the absorption is complete. This indicates sellers are exhausted and limit buyers have control.
Strategy B: The Trend Continuation (Ease of Movement)
Check the Dashboard "Ease of Movement" section.
If "Price per +1K CVD" is significantly higher than "Price per -1K CVD", buyers are efficient.
Wait for a pullback where EKF Velocity hits the "Neutral Zone" (Gray).
SIGNAL: Enter Long when Velocity ticks positive again, aligning with the dominant Ease of Movement stats.
CONFIGURATION GUIDE:
Because this is a quant-grade tool, the settings allow for fine-tuning the physics of the filter.
-- Velocity Decay: Controls how fast momentum resets to zero. Set high (0.98) for trending markets, or lower (0.85) for mean-reverting chop.
-- Volatility Persistence: Controls how "sticky" volatility regimes are.
-- Process Noise: Increase this if the filter feels too laggy; decrease it if the filter feels too jittery (noisy).
-- Measurement Noise: Increase this to trust the Mathematical Model more than the Price Data (smoother output).
WHY OPEN SOURCE?
Complex statistical filtering is often sold behind closed doors in expensive "Black Box" algorithms. By releasing this 3-State EKF open source, the goal is to raise the standard of development on TradingView.
I encourage the community to inspect the code, specifically the "ekf_update_3state" function, to understand how matrix operations can be simulated in Pine Script to create adaptive, self-correcting indicators. And also update me for improvements.
DISCLAIMER:
This tool analyzes microstructure volume data. It requires a subscription plan that supports Intrabar inspection (Premium/Pro recommended for best results). Past performance of the Kalman Filter logic does not guarantee future results. Volume analysis is subjective and should be used as part of a comprehensive strategy.
SUGGESTED SETTINGS
-- Timeframe: Works best on 1m, 3m, or 5m charts (Intrabar data is fetched from 1S).
-- Asset Class: Highly effective on Futures (ES, NQ, BTC) and high-volume Forex/Crypto pairs where volume data is reliable.
-- Background: Dark mode recommended for Dashboard visibility.
WHAT IS A KALMAN FILTER?
Imagine driving a car into a tunnel where your GPS signal is lost.
Prediction: Your car knows its last speed (Velocity) and position. It predicts where you are every second inside the tunnel.
Update: When you exit the tunnel, the GPS connects again. The system compares where it thought you were versus where the satellite says you are.
Correction: It corrects your position and updates its estimate of your speed.
Now apply this to trading:
-- The Tunnel: Market Noise, wicks, and Fake-outs.
-- The Car: The True Market Trend.
-- This Indicator: The navigation system that tells you where the market actually is, ignoring the noise of the tunnel.
Enjoy the indicator and trade safe!
Dr. Jay Desai
(Investment Management & Derivatives Area, Gujarat University)
SA Trump Volatility Pattern Wick + Volume Shock ReversalDisclaimer (read first)
Educational use only — not financial advice. This script does not provide entries/exits, targets, position sizing, or profit guarantees. Trading (especially options/futures) involves substantial risk and can result in loss of principal (and more for leveraged products). Use at your own discretion.
Best use cases on the 2-Hour timeframe
On 2H, this script becomes a high-signal-quality “shock reversal” detector instead of a noisy candle toy. You’re essentially filtering for:
Large wick rejection
Small real body
Statistically unusual volume (Z-score > threshold)
Context alignment (trend filter + prior bar direction + optional RSI)
What 2H is best for
1) Detecting “event shock” reversals
2H bars often capture:
Macro headlines
Fed commentary
earnings reactions (for equities)
sudden volatility expansions
When the script fires on 2H, it often means:
“Aggressive push happened, liquidity got rejected, and participation was unusually high.”
That’s a structural clue, not a trade instruction.
2) Filtering false breakouts / breakdowns
The wick requirement is basically “failed continuation.”
On 2H, this is powerful around:
prior day highs/lows
weekly pivots
obvious consolidation edges
key moving averages (fast SMA / slow SMA gate)
Bull pattern = flush + reclaim behavior.
Bear pattern = pop + rejection behavior.
3) Options traders: timing “premium exposure windows”
On 2H, this is great for options traders who want to avoid buying premium into a fake move.
BullTrump on 2H can be used as a “don’t chase puts / be cautious short” context shift.
BearTrump on 2H can be used as a “don’t chase calls / be cautious long” context shift.
It’s a “regime hint” for the next few sessions, not a one-bar command.
4) Futures traders: rotation vs continuation framework
A 2H “Trump Candle” often marks:
the end of a liquidation leg
a stop-run / squeeze peak
a pivot moment where the market shifts from impulse to balance
Use it to decide whether you’re in:
continuation mode (trend carries)
or rotation mode (mean-reversion / two-way)
How to use it (2H workflow)
Step A — Keep it strict at first
Recommended defaults for 2H:
wickFracThreshold: 0.40–0.55
bodyMaxFrac: 0.35–0.45
volZThresh: 1.0–1.5
useRSIFilter: ON
RSI bull min / bear max: 45 / 55 (good baseline)
Step B — Treat triggers as “context events”
When it prints, ask 3 questions:
Where did it happen? (key level or random spot)
Was it aligned with trend gate? (SMA fast/slow)
Did volume Z-score spike? (true shock vs normal wick)
Higher quality triggers happen when:
the wick pierces a known level (prior swing / range edge)
and the close re-enters the range
and volume Z-score is meaningfully positive
Step C — Confirm with the next 1–2 candles (optional)
On 2H, it’s reasonable to wait for:
a follow-through close
or a hold above/below fast SMA
or a second “acceptance” candle
You can do this manually without changing code.
Other recommended timeframes (best to worst)
✅ 4H (even cleaner, fewer signals)
Use for:
swing context
multi-day pivots
big reversal points
✅ 1H (more signals, still structured)
Use for:
intraday + overnight context
day-trade bias shifts
✅ 30m (for active traders)
Use for:
tighter responsiveness
more setups
But requires more discretion; noise increases.
⚠️ 15m and below (only if you increase strictness)
If you want to run it on 5m/15m:
raise volZThresh (ex: 1.5–2.0)
raise wickFracThreshold (ex: 0.50–0.65)
lower bodyMaxFrac (ex: 0.25–0.35)
Otherwise it will trigger too often.
Best markets for this script
Works best on:
Index futures: /NQ, /ES (big volume makes Z-score meaningful)
Liquid ETFs: SPY, QQQ
High-volume large caps (AAPL, MSFT, NVDA etc.)
Less reliable on:
thin small caps (volume Z-score gets weird)
low-volume premarket candles
illiquid options underlyings
Signal Inside the Script ✅ SA ZoneEngine Bias Filtered is a market-structure bias and confirmation tool designed for futures To request access: 👉 Purchase here: trianchor.gumroad.com
Best GBT for this indicator
chatgpt.com
chatgpt.com
chatgpt.com
SMA Reversal Sequential MTFSMA Reversal Sequential MTF (Multi-Timeframe)OverviewThe SMA Reversal Sequential MTF is a professional-grade price action tool designed to detect qualitative trend shifts and structural breakouts across multiple timeframes simultaneously. Unlike standard crossover indicators, this script analyzes the "curvature" of the Simple Moving Average (SMA) to identify when the market's average momentum has genuinely rotated.1. Core Logic: SMA Slope CurvatureThe script detects a trend reversal when the SMA (20-period by default) changes its trajectory from a "V-shape" (bottoming out) or an "Inverted V-shape" (topping out).The Reversal Algorithm:Bullish Reversal: Occurs when the SMA value at a specific historical offset is higher than the intermediate offset, but the intermediate offset is lower than the most recent value.Bearish Reversal: Occurs when the SMA value at a specific historical offset is lower than the intermediate offset, but the intermediate offset is higher than the most recent value.By using an OFFSET parameter, the script filters out minor price noise, ensuring that only significant rotations in the moving average are labeled.2. Structural Breakout Detection (MSB)Once a reversal is confirmed, the script automatically identifies the Market Structure of that specific timeframe by looking back at the highest high or lowest low within a defined period (LOOKBK).How Breakouts Work:Level Anchoring: When a reversal is detected, the script "locks in" the highest/lowest price of that swing.Confirmation: A "BREAK" signal and a horizontal line are generated only when a candle closes beyond this structural level.Visual Persistence: The break-line is extended to the right, providing a clear visual reference for support-turned-resistance (or vice versa).3. Advanced Multi-Timeframe (MTF) IntegrationMonitor up to 6 timeframes (5M, 15M, 1H, 4H, 1D, 1W) on a single chart.Auto-Filtering (hideLowerTF): To maintain chart clarity, the script can automatically hide timeframe data that is lower than your current chart (e.g., if you are on a 1H chart, 5M and 15M labels are hidden).Non-Repainting: Built using barmerge.gaps_on and confirmed candle logic, ensuring that historical signals remain accurate and do not disappear or move after the fact.4. Dual Preset ModesSwitch between two specialized trading styles with a single click in the settings:PresetParameters (SMA / Offset / Lookback)Ideal ForStandard (Default)20 / 6 / 20Trend following, swing trading, and major pullbacks.Short-Term5 / 4 / 7Scalping, fast day trading, and sensitive structure shifts.5. Visual Interface FeaturesTimeframe Labels: Clearly indicates which timeframe has rotated (e.g., "1H", "15M").Dynamic BREAK Labels: Labels follow the price action with a customizable right-side offset, ensuring they never overlap with the candles.Memory Management: Uses Pine Script Arrays to manage objects, ensuring the script runs smoothly without hitting the platform's drawing limits.6. How to Trade with This ScriptConfluence Trading: Wait for a "BREAK" on a higher timeframe (e.g., 4H) and then look for a matching "REVERSAL" on a lower timeframe (e.g., 15M) to refine your entry.Trailing Stops: Use the structural breakout lines as logical levels for stop-loss placement or profit-taking targets.Technical SpecificationsLanguage: Pine Script v5Overlay: YesAlerts: Compatible with standard alert functions.
このインジケーターは、**「トレンドの質的な転換」と「構造的な重要水準の打破(ブレイク)」**を、マルチタイムフレーム(MTF)で同時に監視する総合的なプライスアクションツールです。1. コア・コンセプト:SMA Reversal通常の移動平均線クロスオーバーとは異なり、このスクリプトは**SMA(単純移動平均線)の「曲率(カーブ)」**に着目します。判定アルゴリズムSMAが「下落から上昇」または「上昇から下落」へ変化する瞬間を、特定のオフセット(間隔)を用いて検知します。上昇転換(V字回復): NYSE:SMA > SMA $ かつ NYSE:SMA < SMA $下落転換(逆V字): NYSE:SMA < SMA $ かつ NYSE:SMA > SMA $これにより、価格の一時的なノイズに惑わされず、移動平均線という「相場の平均的な意思」が明確に方向を変えたタイミングを捉えます。2. 構造的ブレイクアウトの検知転換が確認された際、スクリプトはその時点から遡って過去LOOKBK期間内の最高値・最安値を特定します。これが「構造的なレジスタンス・サポート」として機能します。ブレイクの定義水準の固定: 転換が発生した瞬間の高値・安値を、その時間足の「重要ライン」として記憶します。確定足での判定: 終値がそのラインを明確に上抜いた(または下抜いた)時、チャート上に "BREAK" ラベルと水平線を表示します。3. マルチタイムフレーム(MTF)機能このインジケーターの最大の強みは、1つのチャート上に最大6つの時間足(5M, 15M, 1H, 4H, 1D, 1W)の状態を重ねて表示できる点です。自動フィルタリング: hideLowerTF 設定により、5分足チャートを見ている時は全時間足を表示し、日足チャートを見ている時は日足と週足のみを表示するといった、視認性の自動最適化が行われます。非リペイント処理: barmerge.gaps_on を使用した request.security 処理により、過去の検証データにおいて「未来の情報を参照して描画する」リペイント現象を防いでいます。4. 2つのプリセット設定ユーザーは相場の性質に合わせて、設定画面のチェックボックス一つで計算ロジックを切り替えられます。設定名SMA期間 / オフセット / 参照期間特徴標準 (規定値)20 / 6 / 20中長期的なトレンド転換を捉える。押し目買い・戻り売りに最適。短期 (Short)5 / 4 / 7スキャルピングや短期デイトレ用。微細な構造の変化を素早く察知。5. 視覚的インターフェースの説明転換ラベル (5M, 1H等): その時間足でSMAの転換が確定したポイント。常に「最新の1つ」のみが表示されるため、チャートが煩雑になりません。BREAKラベル & ライン: 構造が破壊された価格水準。ラインは右側に延長され、現在の価格との距離感がひと目で分かります。右オフセット: ブレイクラベルを現在価格より右側に配置することで、ローソク足とラベルが重なるのを防ぎます。6. 推奨される活用法上位足のBREAKを待つ: 例えば、1時間足で "1H BREAK" が出ている方向にのみ、5分足や15分足でエントリーを仕掛ける「環境認識」のツールとして非常に強力です。損切りの目安: 表示されたブレイクラインの反対側に価格が戻ってきた場合、構造が否定されたと判断し、迅速な撤退の根拠にできます。技術仕様(開発者向け)言語: Pine Script v5描画制限: 常に最新のオブジェクト(ライン・ラベル)のみを保持するように配列(Array)でメモリ管理を行っており、TradingViewの描画制限エラーを回避しています。計算コスト: request.security を効率的に呼び出しているため、複数の時間足を表示しても動作は軽快です。
Multi Cycles Predictive System ML - GBM IntegratedMulti-Cycle Predictive System: The Gradient Boosting Machine (GBM) Revolution
Introduction: The Death of Static Analysis
The financial markets are not static; they are a living, breathing, and chaotic system. Yet, for decades, traders have relied on static indicators—using the same RSI settings, the same MACD parameters, and the same Moving Averages regardless of whether the market is trending, chopping, or crashing.
The Multi-Cycle Predictive System (MCPS) represents a paradigm shift. It is not just an indicator; it is an Adaptive Machine Learning Engine running directly on your chart.
By integrating a fully functional Gradient Boosting Machine (GBM), this script does not guess—it learns. It monitors 13 distinct algorithmic models, calculates their real-time accuracy against future price action, and dynamically reallocates influence to the "winning" models using gradient descent.
This is Survival of the Fittest applied to technical analysis.
1. The Core Engine: Gradient Boosting & Adaptive Learning
At the heart of the MCPS is a custom-coded Gradient Boosting Machine. While most "ML" scripts on TradingView simply average a few indicators, this system replicates the architecture of advanced data science models.
How the GBM Works:
Ensemble Prediction: The system aggregates signals from 13 different mathematical models.
Residual Calculation: It compares the ensemble's previous predictions against the actual price movement (Price Return) to calculate the error (Residual).
Gradient Descent: It calculates the gradient of the loss function. We utilize a Huber Loss Gradient, which is robust against outliers (market spikes), ensuring the model doesn't overreact to volatility.
Weight Optimization: Using a configurable learning rate, the system updates the weights of each sub-algorithm. Models that predicted correctly gain weight; models that failed lose influence.
Softmax Normalization: Finally, weights are passed through a Softmax function (with Temperature control) to convert them into probabilities that sum to 1.0.
The "Winner-Takes-All" Philosophy
A common failure in ensemble systems is "Signal Dilution"—where good signals are drowned out by bad ones.
The MCPS solves this with Aggressive Weight Concentration:
Top 3 Logic: The script identifies the top 3 performing algorithms based on historical accuracy.
The 90% Rule: It forces the system to allocate up to 90% of the total decision weight to these top 3 performers.
Result: If Ehlers and Schaff are reading the market correctly, but MACD is failing, MACD is effectively silenced. The system listens only to the winners.
2. The 13 Algorithmic Pillars
The MCPS draws from a diverse library of Digital Signal Processing (DSP), Statistical, and Momentum algorithms. It does not rely on simple moving averages.
Ehlers Bandpass Filter: Isolates the dominant cycle in price data, removing trend and noise.
Zero-Lag EMA (ZLEMA): Reduces lag to near-zero to track momentum shifts instantly.
Coppock Curve: A classic long-term momentum indicator, modified here for adaptive responsiveness.
Detrended Price Oscillator (DPO): Eliminates the trend to identify short-term cycles.
Schaff Trend Cycle (STC): A double-smoothed stochastic of the MACD, excellent for identifying cycle turns.
Fisher Transform: Converts price into a Gaussian normal distribution to pinpoint turning points.
MESA Adaptive: Uses Maximum Entropy Spectral Analysis to detect the current dominant cycle period.
Goertzel Algorithm: A DSP technique used to identify the magnitude of specific frequency components in the price wave.
Hilbert Transform: Extracts the instantaneous amplitude and phase of the price action.
Autocorrelation: Measures the similarity between the price series and a lagged version of itself to detect periodicity.
Singular Spectrum Analysis (SSA): Decomposes the time series into trend, seasonal, and noise components (Simplified).
Wavelet Transform: Analyzes data at different scales (frequencies) simultaneously.
Empirical Mode Decomposition (EMD): Splits data into Intrinsic Mode Functions (IMFs) to isolate pure cycles.
3. The Dashboard: Total Transparency
Black-box algorithms are dangerous. You need to know why a signal is being generated. The MCPS features two detailed dashboards (tables) located at the bottom of your screen.
The Weight & Accuracy Table (Bottom Right)
This is your "Under the Hood" view. It displays:
Algorithm: The name of the model.
Accuracy: The rolling historical accuracy of that specific model over the lookback period (e.g., 58.2%).
Weight: The current influence that model has on the final signal. Watch this change in real-time. You will see the system "giving up" on bad models and "betting heavy" on good ones.
Prob/Sig: The raw probability and directional signal (Up/Down).
The GBM Stats Table (Bottom Left)
Tracks the health of the Machine Learning engine:
Iterations: How many learning cycles have occurred.
Entropy: A measure of market confusion. High entropy means weights are spread out (models disagree). Low entropy means the models are aligned.
Top 3 Weight: Shows how concentrated the decision power is. If this is >80%, the system is highly confident in specific models.
Confidence & Agreement: Statistical measures of the signal strength.
4. How to Trade with MCPS
This system outputs a single, composite Cycle Line (oscillating between -1 and 1) and a background Regime Color.
Strategy A: The Zero-Cross (Trend Reversal)
Bullish: When the Cycle Line crosses above 0. This indicates that the weighted average of the top-performing algorithms has shifted to a net-positive expectation.
Bearish: When the Cycle Line crosses below 0.
Strategy B: Probability Extremes (Mean Reversion)
Strong Buy: When the Cycle Line drops below -0.5 (Oversold) and turns up. This indicates a high-probability cycle bottom.
Strong Sell: When the Cycle Line rises above +0.5 (Overbought) and turns down.
Strategy C: Regime Filtering
The background color changes based on the aggregate consensus:
Green/Lime: Bullish Regime. Look primarily for Long entries. Ignore weak sell signals.
Red/Orange: Bearish Regime. Look primarily for Short entries.
Gray: Neutral/Choppy. Reduce position size or wait.
5. Configuration & GBM Settings
The script is highly customizable for advanced users who want to tune the Machine Learning hyperparameters.
Prediction Horizon: How many days into the future are we trying to predict? (Default: 3).
Accuracy Lookback: How far back does the model check to calculate "Accuracy"?
GBM Learning Rate: Controls how fast the model adapts.
High (0.2+): Adapts instantly to new market conditions but may be "jumpy."
Low (0.05): Very stable, long-term adaptation.
Temperature: Controls the "Softmax" function. Higher temperatures allow for softer, more distributed weights. Lower temperatures force a "Winner Takes All" outcome.
Max Top 3 Weight: The cap on how much power the top 3 models can hold (Default: 90%).
6. Technical Nuances (For the Geeks)
Huber Gradient: We use Huber loss rather than MSE (Mean Squared Error) for the gradient descent. This is crucial for financial time series because price spikes (outliers) can destroy the learning process of standard ML models. Huber loss transitions from quadratic to linear error, making the model robust.
Regularization: L2 Regularization is applied to prevent overfitting, ensuring the model doesn't just memorize past noise.
Memory Decay: The model has a "fading memory." Recent accuracy is weighted more heavily than accuracy from 200 bars ago, allowing the system to detect Regime Shifts (e.g., transitioning from a trending market to a ranging market).
Disclaimer:
This tool is a sophisticated analytical instrument, not a crystal ball. Machine Learning attempts to optimize probabilities based on historical patterns, but no algorithm can predict black swan events or fundamental news shocks. Always use proper risk management.
The "Warmup Period" is required. The script needs to process 50 bars of history before the GBM engine initializes and produces signals.
Author's Note:
I built the MCPS because I was tired of indicators that stopped working when the market "personality" changed. By integrating GBM, this script adapts to the market's personality in real-time. If the market is cycling, Ehlers and Goertzel take over. If the market is trending, Coppock and ZLEMA take the lead. You don't have to choose—the math chooses for you.
Please leave a boost and a comment if you find this helpful!
Joegtradez Custom High and Low Linescustom high/low lines used for intaday markouts can also be used to mark out sessions high/low works on all timeframes etc
Multi Asset & Multi Timeframe Trend DashboardOverview
The Multi-Asset & Multi-Timeframe Trend Dashboard is a comprehensive visual data terminal designed to provide a bird's-eye view of market sentiment across five different assets and seven distinct timeframes simultaneously. By consolidating 10 core technical indicators into a single table, it eliminates the need for "chart hopping" and helps traders identify high-probability trend alignment.
How It Works
The dashboard evaluates each asset based on a Scoring System ($-10$ to $+10$). For every timeframe, the script analyzes the following 10 conditions:
Trend: EMA 20 > EMA 50Macro
Trend: EMA 50 > EMA 200
Position: Price > EMA 200
MACD: MACD Line > Signal Line
MACD Momentum: MACD Histogram > 0
RSI Momentum: RSI(14) > RSI SMA(14)
RSI Level: RSI(14) > 50
Stochastics: Stoch K > D
CCI: Commodity Channel Index > 0
Awesome Oscillator: AO > 0
Visual Logic & Features
Indicator Dots (■): Represent the 10 individual technical conditions. Green indicates a bullish state; Red indicates a bearish state.
Trend Arrows (▲/▼): Displays the aggregate directional bias of a timeframe based on the sum of the 10 dots.
Neutral State (✖): If indicators are split 50/50 (Score of 0), a grey cross is displayed to indicate total market indecision.
"ALL" Column: A macro-summary that aggregates scores across all four primary timeframes.
Volatility Marker (•): A dot appearing next to the symbol name indicates that current ATR is higher than the historical average (user-defined threshold).
Market Status Color: The symbol name background turns Green if the market is currently open and active, and Red if it is closed or stagnant.
Technical Implementation
This script utilizes request.security calls to fetch data across timeframes. To ensure performance and prevent repainting issues, all security calls are handled using the barstate.islast flag to only render the dashboard on the most recent bar.
How to Use
Alignment Trading: Look for "Full House" scenarios where all arrows (15m through Daily) are the same color.
Scalping Bias: Use the "Mini Timeframes" (1m, 3m, 5m) to find entries that align with the higher timeframe trend shown in the main table.
Volatility Filter: Only take trades when the volatility marker (•) is active to ensure there is enough "power" in the move.
Sector Momentum Dashboard (3-1M / 6-1M / 12-1M, Compact)This indicator provides a compact sector‑momentum dashboard designed for ETF rotation and relative strength analysis. It calculates true daily momentum using three institutional lookback windows (3‑1M, 6‑1M, 12‑1M), allowing traders to evaluate short‑term, medium‑term, and long‑term sector leadership. The table ranks major US sector ETFs by momentum, highlights the strongest and weakest performers, and updates dynamically regardless of the chart timeframe. This tool is intended for traders who want a clear, efficient view of sector rotation trends to support tactical allocation, momentum strategies, and market‑strength assessment.
Segment 4h modifiable via inputsSegment 4h modifiable via inputs : pour positionner un segment n'importe ou en modifiant le prix pour la hauteur dans la configuration et déplaçable facilement à la souris temporellement.
4-hour segment modifiable via inputs: to position a segment anywhere by modifying the price for the height in the configuration and easily movable with the mouse in terms of time
SMA by EVEV Simple Moving Average (SMA) is a lightweight, open-source SMA indicator with configurable length, price source, and visual offset. It is designed to provide a clean moving-average reference for trend context and mean reversion workflows on any market and timeframe. The offset parameter shifts the plotted line for visualization only and does not affect the underlying calculation.
LogTrend Retest EngineLogTrend Retest Engine (LTRE)
LogTrend Retest Engine (LTRE) is an advanced trend-continuation overlay designed to identify high-probability breakout retests using logarithmic regression , volatility-adjusted deviation bands , and market regime filtering .
Unlike traditional channels or moving averages, LTRE models price behavior in log space , allowing it to adapt naturally to exponential market moves common in crypto, indices, and long-term trends.
🔹 How It Works
Logarithmic Regression Core
Performs linear regression on log-transformed price and time
Produces a structurally accurate trend midline that scales with price growth
Volatility-Adjusted Deviation Bands
Dynamic upper and lower zones based on statistical deviation
ATR weighting expands or contracts bands as volatility changes
Adaptive Lookback (Optional)
Automatically adjusts regression length using volatility pressure
Faster response in high-volatility environments, smoother in consolidation
🔹 Market Regime Detection
LTRE actively filters conditions using:
R² trend strength (trend quality, not just slope)
Volatility compression vs expansion
User-defined minimum trend strength threshold
Signals are disabled during ranging or low-quality conditions .
🔹 Breakout → Retest Signal Logic
LTRE does not chase breakouts.
Signals trigger only when:
1. Price breaks cleanly outside the deviation band
2. Market regime is confirmed as trending
3. Price performs a controlled retest within a user-defined tolerance
BUY
Break above upper band → retest → trend confirmed
SELL
Break below lower band → retest → trend confirmed
This structure is designed to reduce false breakouts and late entries.
🔹 Visual & Projection Tools
Clean midline and deviation bands
Optional filled zones
Optional future trend projection for forward structure planning
On-chart statistics for trend strength and volatility compression
🔹 Best Use Cases
Trend continuation & pullback strategies
Crypto, Forex, Indices, and equities
Works best on 15m and higher timeframes
⚠️ Disclaimer
LTRE is a decision-support tool , not a complete trading system. Always use proper risk management and confirm signals with additional structure, volume, or higher-timeframe context.
Built for traders who wait for structure — not noise.
Adaptive Log Trend Zones + Retest SignalsAdaptive Log Trend Zones + Retest Signals
Adaptive Log Trend Zones is a trend-following overlay built to identify high-probability breakout retests in strong market conditions. It combines logarithmic regression , volatility-adaptive behavior , and ATR-based trend zones to help traders stay aligned with dominant momentum while avoiding chop.
🔹 Core Features
Logarithmic Regression Midline
Uses linear regression on log price to better handle exponential market moves
Produces smoother, more realistic trend structure on higher timeframes
Volatility-Adaptive Lookback
Automatically expands or contracts the regression length based on ATR volatility
Reacts faster in high volatility, smoother in consolidation
Dynamic Trend Zones
Upper and lower bands are ATR-adjusted and trend-colored
Optional future projection for visual trend guidance
Breakout → Retest Signal Logic
Detects clean breakouts beyond the trend zone
Waits for a controlled pullback (retest) before signaling
Signals only trigger when trend strength is confirmed
Trend Quality Filter
Internal regime detection filters out low-quality, sideways conditions
Uses slope strength and volatility compression to validate entries
🔹 Signals
BUY : Bullish breakout followed by a valid retest in a trending regime
SELL : Bearish breakout followed by a valid retest in a trending regime
Signals are designed for trend continuation , not mean reversion.
🔹 Best Use Cases
Crypto, Forex, and Index markets
Higher timeframes (15m+ recommended)
Trend continuation and pullback strategies
⚠️ Notes
This indicator is not a standalone trading system . Always use proper risk management and confirm signals with structure, volume, or higher-timeframe context.
Designed for traders who prefer structure, patience, and momentum alignment.
TDPOWERSYS vs Market-Cap Weighted Peersfor QIC - UnCut Diamonds team..
to compare one company vs its peers bundled as basket.
editable..
Daily Extension from 50DMA (adjustable) in ATR%Indicator to easily spot over extended prices in relation to ATR.
ATR or ADR easily referenced
Free cash flow yield (Quarterly)Indicator: Free Cash Flow Yield (Quarterly) — Technical Description
Purpose
This indicator plots Free Cash Flow Yield (FCF Yield) using quarterly fundamentals and optionally adjusts it for dilution. It also computes trailing averages over multiple horizons (in quarters) to give a long-term valuation context.
Data Sources
All fundamentals are pulled from TradingView’s financial dataset using:
request.financial(syminfo.tickerid, , "FQ", barmerge.gaps_on)
Where:
"FQ" = Quarterly frequency
barmerge.gaps_on = keeps values as step-like series (updates only when new quarterly data is available)
Financial fields used:
FREE_CASH_FLOW (FCF)
ENTERPRISE_VALUE (EV)
TOTAL_SHARES_OUTSTANDING
DILUTED_SHARES_OUTSTANDING
Market cap is derived (not pulled directly in this version):
marketCap = totalSharesOutstanding * close
(Only used as a reference in the script; the yield itself is based on EV.)
Core Calculation
1) FCF Yield (Net)
The base yield is:
FCF Yield
(
%
)
=
FCF
Enterprise Value
×
100
FCF Yield(%)=
Enterprise Value
FCF
×100
Implementation detail:
If FCF is na or EV is na or EV == 0, the result is set to na to avoid division errors.
Dilution Adjustment (Optional Series)
2) Dilution Ratio
The script estimates dilution impact using:
dilutionRatio
=
Total Shares Outstanding
Diluted Shares Outstanding
dilutionRatio=
Diluted Shares Outstanding
Total Shares Outstanding
Notes:
If dilutedSharesOutstanding is missing or zero, the ratio becomes na.
3) Diluted FCF Yield
If the ratio indicates dilution (<= 1), yield is scaled down:
FCF Yield Diluted
=
FCF Yield
×
dilutionRatio
FCF Yield Diluted=FCF Yield×dilutionRatio
Else (ratio > 1 or na), the script defaults to the net yield:
FCF Yield Diluted
=
FCF Yield
FCF Yield Diluted=FCF Yield
Practical interpretation:
More dilution → lower ratio → lower diluted yield.
If dilution fields are not reliable for a ticker, the script falls back to the base yield.
Plotting
Two series are shown:
FCF Yield Net: plotted as columns (bars)
FCF Yield Diluted: plotted as an area overlay
This makes it easy to see:
Step changes when new quarter data arrives
Whether dilution meaningfully reduces the yield
Labels (Per-bar)
When fcfYieldDiluted > 0, the script prints the value as a percentage label at the yield level.
Important technical point:
Since fcfYieldDiluted is computed as a number like 8.5 for 8.5%, labels convert to percent format by dividing by 100 before formatting:
str.tostring(fcfYieldDiluted / 100, format.percent)
Rolling History & Averages
1) Rolling storage
The script maintains a rolling array of the most recent 40 quarterly values:
40 quarters ≈ 10 years
Each time a non-NA quarterly yield appears:
It pushes it into the array
If array length exceeds 40, it removes the oldest value
2) Trailing averages (quarter windows)
Averages are computed over the most recent N quarters:
1Q (latest quarter value)
4Q ≈ 1 year
8Q ≈ 2 years
20Q ≈ 5 years
40Q ≈ 10 years
If fewer than N values exist, that average is na.
End-of-chart Summary Label
On the last bar (barstate.islast), the script draws a summary label containing the trailing averages listed above.
Placement logic
The label is positioned slightly to the right of the current bar:
Uses frequencyUnit (estimated number of chart bars per quarter) to offset the label into the future.
frequencyUnit is computed as:
frequencyUnit
≈
Seconds in 12 months
Seconds per chart bar
÷
4
frequencyUnit≈
Seconds per chart bar
Seconds in 12 months
÷4
This is only for visual spacing, not calculation correctness.
Limitations / Notes
The yield series is “step-like” and updates only when new quarterly fundamentals are available.
For some tickers, TradingView fundamentals (especially diluted shares) can be missing or inconsistent; the script protects against this by returning na or falling back to the net yield.
EV-based yield can differ from market-cap-based yield; EV includes debt and cash effects, so it’s closer to an “all-capital” valuation measure.






















