Non-Repainting Colorful RegressionNon-Repainting Colorful Regression. Inspired by Colorful Regression, I created non-repainting colorful regression script using Gemini completely.
อินดิเคเตอร์และกลยุทธ์
SPX + DJI Overlay Template1 second chart to tell direct of DJ vs SPX
//@version=5
indicator("SPX + DJI Overlay Template", overlay=true)
sym_spx = input.symbol("TVC:SPX", "SPX (derived / CFD)")
sym_dji = input.symbol("TVC:DJI", "DJI")
spx_close = request.security(sym_spx, timeframe.period, close)
dji_close = request.security(sym_dji, timeframe.period, close)
var float spx_base = na
var float dji_base = na
if barstate.isfirst
spx_base := spx_close
dji_base := dji_close
norm_spx = (spx_close / spx_base) * 100
norm_dji = (dji_close / dji_base) * 100
plot(norm_spx, color=color.blue, title="SPX (normalized)")
plot(norm_dji, color=color.orange, title="DJI (normalized)")
plot(norm_spx - norm_dji, color=color.red, title="Difference", style=plot.style_line)
Open Range Breakout (ORB) with Alerts and LabelsOpen Range Breakout (ORB) with Alerts and Labels and signals
WESSLO RSI Signals (Strong/Weak Buy + SAT-80 & SAT-HIZLI)WESSLO RSI Signals (Strong/Weak Buy + SAT-80 & SAT-HIZLI)
Grouped Peaks Screener (5/5) V4//@version=6
indicator("Grouped Peaks Screener (5/5) — Intraday (04:00 ET reset) — screener ready", overlay=true, max_lines_count=500, max_labels_count=0, max_boxes_count=0, format=format.volume)
// ---------- user spec constants
LEFT = 5
RIGHT = 5
MS_PER_DAY = 24 * 60 * 60 * 1000
// ---------- typed arrays (Pine v6 best practice)
var int grp_ticks = array.new_int()
var int grp_counts = array.new_int()
var int grp_types = array.new_int() // 1 = high(res), -1 = low(sup)
var int grp_start = array.new_int() // bar_index of earliest peak in group
var line grp_lines = array.new_line()
var bool grp_active = array.new_bool()
// ---------- table (top-right)
max_table_rows = 20
var table infoTbl = table.new(position.top_right, 2, max_table_rows + 1, border_width = 1)
// ---------- helper: safely clear groups and delete drawings
f_clear_groups() =>
int nLines = array.size(grp_lines)
if nLines > 0
for i = 0 to nLines - 1
line ln = array.get(grp_lines, i)
if not na(ln)
line.delete(ln)
array.clear(grp_ticks)
array.clear(grp_counts)
array.clear(grp_types)
array.clear(grp_start)
array.clear(grp_lines)
array.clear(grp_active)
// ---------- trading day detection (premarket start 04:00 ET)
int y = year(time, "America/New_York")
int mo = month(time, "America/New_York")
int d = dayofmonth(time, "America/New_York")
int preStart = timestamp("America/New_York", y, mo, d, 4, 0)
int trading_day_start = time >= preStart ? preStart : preStart - MS_PER_DAY
var int prev_trading_day_start = na
if na(prev_trading_day_start)
prev_trading_day_start := trading_day_start
// reset at new premarket
if trading_day_start != prev_trading_day_start
f_clear_groups()
prev_trading_day_start := trading_day_start
bool allow_detection = time >= trading_day_start
// ---------- pivot detection (5 left / 5 right)
float ph = ta.pivothigh(high, LEFT, RIGHT)
float pl = ta.pivotlow(low, LEFT, RIGHT)
// ---------- process peak (add new or merge into existing same-price group)
f_process_peak(float price, int startBar, int kind) =>
int tick = int(math.round(price / syminfo.mintick))
int found = -1
int sz = array.size(grp_ticks)
if sz > 0
for i = 0 to sz - 1
if array.get(grp_active, i) and array.get(grp_types, i) == kind and array.get(grp_ticks, i) == tick
found := i
break
if found != -1
// merge into existing group
array.set(grp_counts, found, array.get(grp_counts, found) + 1)
if startBar < array.get(grp_start, found)
array.set(grp_start, found, startBar)
line ln = array.get(grp_lines, found)
if not na(ln)
line.set_xy1(ln, startBar, float(array.get(grp_ticks, found)) * syminfo.mintick)
line.set_xy2(ln, startBar + 1, float(array.get(grp_ticks, found)) * syminfo.mintick)
line ln2 = array.get(grp_lines, found)
if not na(ln2)
line.set_color(ln2, color.yellow)
else
color col = kind == 1 ? color.red : color.green
line lnNew = line.new(startBar, price, startBar + 1, price, xloc = xloc.bar_index, extend = extend.right, color = col, width = 2)
array.push(grp_ticks, tick)
array.push(grp_counts, 1)
array.push(grp_types, kind)
array.push(grp_start, startBar)
array.push(grp_lines, lnNew)
array.push(grp_active, true)
// apply pivots (pivot bar is bar_index - RIGHT, pivot confirmed at current bar)
if not na(ph)
int pivotBarIdxH = bar_index - RIGHT
int pivotTimeH = time
if allow_detection and pivotTimeH >= trading_day_start
f_process_peak(ph, pivotBarIdxH, 1)
if not na(pl)
int pivotBarIdxL = bar_index - RIGHT
int pivotTimeL = time
if allow_detection and pivotTimeL >= trading_day_start
f_process_peak(pl, pivotBarIdxL, -1)
// ---------- deletion rule: if price crosses level by >=1 tick -> delete group immediately
int nGroups = array.size(grp_ticks)
if nGroups > 0
for i = 0 to nGroups - 1
if array.get(grp_active, i)
int tick = array.get(grp_ticks, i)
int kind = array.get(grp_types, i)
int startB = array.get(grp_start, i)
if bar_index >= startB
if kind == 1
int highTick = int(math.round(high / syminfo.mintick))
if highTick > tick
line ln = array.get(grp_lines, i)
if not na(ln)
line.delete(ln)
array.set(grp_active, i, false)
else
int lowTick = int(math.round(low / syminfo.mintick))
if lowTick < tick
line ln = array.get(grp_lines, i)
if not na(ln)
line.delete(ln)
array.set(grp_active, i, false)
// ---------- Update top-right table "Equal H/L" and "Equal H/L price"
// header
table.cell(infoTbl, 0, 0, "Equal H/L", text_color = color.white, bgcolor = color.new(color.gray, 40))
table.cell(infoTbl, 1, 0, "Equal H/L price", text_color = color.white, bgcolor = color.new(color.gray, 40))
// clear rest of rows to avoid stale values
for r = 1 to max_table_rows
table.cell(infoTbl, 0, r, "", text_color = color.white, bgcolor = color.new(color.black, 100))
table.cell(infoTbl, 1, r, "", text_color = color.white, bgcolor = color.new(color.black, 100))
// populate grouped entries (count >= 2) that are active today
int row = 1
if array.size(grp_ticks) > 0
for i = 0 to array.size(grp_ticks) - 1
if array.get(grp_active, i) and array.get(grp_counts, i) >= 2
int kind = array.get(grp_types, i)
string typS = kind == 1 ? "H" : "L"
string leftText = str.tostring(array.get(grp_counts, i)) + "x " + typS
float p = float(array.get(grp_ticks, i)) * syminfo.mintick
string ptxt = str.tostring(p, format.mintick)
table.cell(infoTbl, 0, row, leftText, text_color = color.white, bgcolor = color.new(color.black, 60))
table.cell(infoTbl, 1, row, ptxt, text_color = color.white, bgcolor = color.new(color.black, 60))
row += 1
if row > max_table_rows
break
// ---------- Screener-ready plot (use this plot as the Screener column/filter)
// Screener reads plots. Plot = 1 when there is at least one active grouped Equal H/L (count >= 2)
bool hasEqualHL = false
if array.size(grp_ticks) > 0
for i = 0 to array.size(grp_ticks) - 1
if array.get(grp_active, i) and array.get(grp_counts, i) >= 2
hasEqualHL := true
break
// Additional check: ensure we have enough data for the pivot detection
bool hasEnoughData = bar_index >= LEFT + RIGHT + 10 // Add some buffer
// Only consider EqualHL valid if we have enough data and it's within the current trading day
bool isValidEqualHL = hasEqualHL and hasEnoughData and allow_detection
float equalHLPlot = isValidEqualHL ? 1.0 : 0.0
// Hidden on chart but visible to Screener. If you prefer a visible mark remove `display=display.none`.
plot(equalHLPlot, title="EqualHL", style=plot.style_columns, color=color.new(color.yellow, 0), linewidth=2, display=display.none)
// invisible plot to keep indicator active
plot(na)
Stretch IndicatorThis indicator calculates the distance from the EMA200 in percentage, aiming to show how far the price is stretched from the EMA200 in either direction
Liquidity Scalp with SL 1% and Max Hold Bars profitis by tabrez my owe indicator 8hr wrok on this 1 stratgiy tabrez raj mafia samaar raj
BTC TOPperThe BTC TOPper indicator is a sophisticated technical analysis tool designed to identify critical price levels where Bitcoin's weekly Simple Moving Average (SMA) intersects with historically significant All-Time High (ATH) levels. This indicator is particularly valuable for long-term trend analysis and identifying potential reversal zones in Bitcoin's price action.
Key Features:
🔹 Weekly SMA Analysis: Uses a 200-period Simple Moving Average on weekly timeframe to smooth out short-term volatility and focus on long-term trends
🔹 Persistent Historical ATH Tracking: Automatically detects and "freezes" ATH levels that have been held for more than one year, creating persistent reference levels
🔹 Multi-Level Cross Detection: Tracks up to 10 different frozen ATH levels simultaneously, providing comprehensive historical context
🔹 Visual Cross Alerts: Highlights entire weeks with red background when the weekly SMA crosses any frozen ATH level, making signals impossible to miss
🔹 Advanced Smoothing Options: Includes optional secondary moving averages (SMA, EMA, SMMA, WMA, VWMA) with Bollinger Bands for enhanced analysis
🔹 Customizable Parameters: Adjustable SMA length, offset, and smoothing settings to fit different trading strategies
How It Works:
ATH Detection: Continuously monitors for new all-time highs
Level Freezing: After an ATH is held for 1+ year, it becomes a "frozen" historical level
Cross Monitoring: Watches for intersections between the 200-week SMA and any frozen ATH level
Signal Generation: Highlights the entire week when a cross occurs, providing clear visual alerts
Trading Applications:
Long-term Trend Analysis: Identify when Bitcoin approaches historically significant resistance levels
Reversal Zone Detection: Spot potential areas where price might reverse based on historical context
Support/Resistance Confirmation: Use frozen ATH levels as dynamic support and resistance zones
Market Structure Analysis: Understand how current price relates to historical market cycles
Best Practices:
Use on weekly timeframe for optimal results
Combine with other technical indicators for confirmation
Pay attention to multiple frozen levels clustering in the same price range
Consider market context and fundamentals alongside technical signals
Settings:
Length: 200 (default) - SMA period
Source: Close price
Smoothing: Optional secondary MA with multiple types available
Bollinger Bands: Optional volatility bands around secondary MA
This indicator is ideal for Bitcoin traders and analysts who want to understand the relationship between current price action and historical market structure, particularly useful for identifying potential major reversal zones based on historical ATH levels.
JBK — 2 bougies (tailles B1/B2 + contraintes + 4 EMA) JBK — 2 bougies (tailles B1/B2 + contraintes + 4 EMA)
Normalized Portfolio TrackerThis script lets you create, visualize, and track a custom portfolio of up to 15 assets directly on TradingView.
It calculates a synthetic "portfolio index" by combining multiple tickers with user-defined weights, automatically normalizing them so the total allocation always equals 100%.
All assets are scaled to a common starting point, allowing you to compare your portfolio’s performance versus any benchmark like SPY, QQQ, or BTC.
🚀 Goal
This script helps traders and investors:
• Understand the combined performance of their portfolio.
• Normalize diverse assets into a single synthetic chart .
• Make portfolio-level insights without relying on external spreadsheets.
🎯 Use Cases
• Backtest your portfolio allocations directly on the chart.
• Compare your portfolio vs. benchmarks like SPY, QQQ, BTC.
• Track thematic baskets (commodities, EV supply chain, regional ETFs).
• Visualize how each component contributes to overall performance.
📊 Features
• Weighted Portfolio Performance : Combines selected assets into a synthetic value series.
• Base Price Alignment : Each asset is normalized to its starting price at the chosen date.
• Dynamic Portfolio Table : Displays symbols, normalized weights (%), equivalent shares (based on each asset’s start price, sums to 100 shares), and a total row that always sums to 100%.
• Multi-Asset Support : Works with stocks, ETFs, indices, crypto, or any TradingView-compatible symbol.
⚙️ Configuration
Flexible Portfolio Setup
• Add up to 15 assets with custom weight inputs.
• You can enter any arbitrary numbers (e.g. 30, 15, 55).
• The script automatically normalizes all weights so the total allocation always equals 100%.
Start Date Selection
• Choose any custom start date to normalize all assets.
• The portfolio value is then scaled relative to the main chart symbol, so you can directly compare portfolio performance against benchmarks like SPY or QQQ.
Chart Styles
• Candlestick chart
• Heikin Ashi chart
• Line chart
Custom Display
• Adjustable colors and line widths
• Optionally display asset list, normalized weights, and equivalent shares
⚙️ How It Works
• Fetch OHLC data for each asset.
• Normalizes weights internally so totals = 100%.
• Stores each asset’s base price at the selected start date.
• Calculates equivalent “shares” for each allocation.
• Builds a synthetic portfolio value series by summing weighted contributions.
• Renders as Candlestick, Heikin Ashi, or Line chart.
• Adds a portfolio info table for clarity.
⚠️ Notes
• This script is for visualization only . It does not place trades or auto-rebalance.
• Weight inputs are automatically normalized, so you don’t need to enter exact percentages.
Phân tích Đa Khung Thời gian
//@version=5
indicator("Phân tích Đa Khung Thời gian", shorttitle="Manual Analysis", overlay=true)
// ============== INPUTS CHO BẢNG PHÂN TÍCH XU HƯỚNG ==============
monthlyTrend = input.string("Bullish", title="Xu hướng Monthly", options= )
weeklyTrend = input.string("Bullish", title="Xu hướng Weekly", options= )
dailyTrend = input.string("Bullish", title="Xu hướng Daily", options= )
h4Trend = input.string("Bullish", title="Xu hướng H4", options= )
h1Trend = input.string("Bullish", title="Xu hướng H1", options= )
m30Trend = input.string("Bullish", title="Xu hướng M30", options= )
m15Trend = input.string("Bullish", title="Xu hướng M15", options= )
m5Trend = input.string("Bullish", title="Xu hướng M5", options= )
m1Trend = input.string("Bullish", title="Xu hướng M1", options= )
// Mảng chứa nhãn và xu hướng
labels = array.from("Mn", "W", "D", "H4", "H1", "M30", "M15", "M5", "M1")
trends = array.from(monthlyTrend, weeklyTrend, dailyTrend, h4Trend, h1Trend, m30Trend, m15Trend, m5Trend, m1Trend)
// ============== TẠO VÀ CẬP NHẬT BẢNG DUY NHẤT ==============
// Sắp xếp bảng nằm ngang
var table manual_analysis_table = table.new(position.top_right, array.size(labels), 2, bgcolor=color.new(color.black, 80), border_width=1)
if barstate.islast
// TIÊU ĐỀ HÀNG ĐẦU TIÊN (Nhãn khung thời gian)
for i = 0 to array.size(labels) - 1
table.cell(manual_analysis_table, i, 0, array.get(labels, i), text_color=color.white, bgcolor=color.new(color.blue, 50), text_size=size.small)
// ĐỔ DỮ LIỆU XU HƯỚNG VÀO HÀNG THỨ HAI
for i = 0 to array.size(trends) - 1
trendStatus = array.get(trends, i)
trendColor = trendStatus == "Bullish" ? color.green : color.red
trendSymbol = trendStatus == "Bullish" ? "▲" : "▼"
table.cell(manual_analysis_table, i, 1, trendSymbol, text_color=trendColor)
Franja de pre-mercadoThis indicator highlights the entire period from the end of the regular New York trading session through the overnight and pre-market, until the market reopens the next morning.
By default, the highlighted band starts at 16:30 New York time (15 minutes after the official close at 16:15) and continues without interruption through the night until 09:30 New York time, when the regular session begins.
🔹 Works for both futures and stocks (you can adjust the closing time if needed: 16:15 for futures, 16:00 for equities).
🔹 Option to include or exclude weekends.
🔹 Optional highlight for the last hour of RTH (e.g. 15:15–16:15 NY).
🔹 Fully customizable colors and offsets.
This tool helps traders clearly separate the overnight activity and pre-market moves from the main session, making it easier to analyze price action and market structure.
Tight 5-10 SMA Wedge ScannerIndicator for helping filter out high growth momentum names to look for stocks that are consolidating near the 5 & 10 SMA. Do a general scan first using trading view scanner 1,3,6 month performance > 30%, Price > 20,50,200 SMA, ADR > 3%, Price * Vol > 5M. Copy this into a watchlist and head over to tradingview website and access Pine screener under Products -> Screeners -> Pine. Select your watchlist with your stocks and add this indicator after favoriting it, select SMA Spread % set to below value 3 or whatever number you want, select Price Diff % set to below value 5 or whatever number you want. Now you listed should be significantly reduced to names that are close to breaking out and flagging.
Tight 10-20-50 SMA Wedge Scanner Indicator for helping filter out high growth momentum names to look for stocks that are consolidating near the 10 & 20 & 50 SMA. Do a general scan first using trading view scanner 1,3,6 month performance > 30%, Price > 50, 200 SMA, ADR > 3%, Price * Vol > 5M. Copy this into a watchlist and head over to tradingview website and access Pine screener under Products -> Screeners -> Pine. Select your watchlist with your stocks and add this indicator after favoriting it, select SMA Spread % set to below value 3 or whatever number you want, select Price Diff % set to below value 5 or whatever number you want. Now you listed should be significantly reduced to names that are close to breaking out and flagging.
Relative Volume (Premarket + TF Override) [Screener-ready]This indicator picks up the Relative Volume in Pre Market. Now there is an indicator you can include it to filter in a pre market sreener. To pick up high Rel Volume (x5) spiking in Pre Market.
Tight 10-20 SMA Wedge ScannerIndicator for helping filter out high growth momentum names to look for stocks that are consolidating near the 10 & 20 SMA. Do a general scan first using trading view scanner 1,3,6 month performance > 30%, Price > 20,50,200 SMA, ADR > 3%, Price * Vol > 5M. Copy this into a watchlist and head over to tradingview website and access Pine screener under Products -> Screeners -> Pine. Select your watchlist with your stocks and add this indicator after favoriting it, select SMA Spread % set to below value 3 or whatever number you want, select Price Diff % set to below value 5 or whatever number you want. Now you listed should be significantly reduced to names that are close to breaking out and flagging.
Mongoose Compass Ribbon — Regime Overlay & SizingWhat it does
Mongoose Compass Ribbon paints the price chart background by market regime and displays a suggested position size.
It mirrors the Compass panel’s 4-pillar score (0–4) and can lock calculations to Weekly while you view Daily or intraday charts.
Regimes
Expansion: score ≥ 3 (green)
Neutral: score = 2 (orange)
Contraction: score ≤ 1 (red)
Pillars (same as panel):
RS IWM/SPY (small-cap leadership)
Credit HYG/LQD (risk financing)
Growth Copper/Gold (cyclical vs safety)
Participation (first available): Breadth → CBOE:DSPX → RSP/SPY proxy
A floating label shows Score and Suggested size (default ramp: 0/30/60/90/100% for scores 0–4).
How to use
Anchor on Weekly. Keep Regime Timeframe = W so the ribbon shows the higher-timeframe state while you trade on Daily.
Act on flips:
Expansion (≥3): increase beta, reduce hedges.
Neutral (2): keep moderate beta; favor quality/mega vs small caps until RS or Cu/Au turns.
Contraction (≤1): de-risk, rotate defensive, add hedges.
Turn on the built-in alerts: Expansion Regime and Contraction Regime.
Methodology
Prices are fetched via request.security on the selected Regime Timeframe.
Each pillar uses ratio signals smoothed with an SMA (Smoothing Length), and binary rules:
RS / Credit / Growth: fast SMA(len) vs slow SMA(len*2)
Breadth: normalized > 60
DSPX: normalized < 40
RSP/SPY proxy: fast > slow
Score is the count of green pillars (0–4).
Suggested size is a fixed mapping from score (user-editable).
Settings
Sources
Defaults use liquid ETFs (BATS/AMEX). Copper/Gold can be switched to futures if your plan supports them.
Breadth (optional): paste a %>MA symbol if you have one. If blank, the script uses CBOE:DSPX; if DSPX isn’t available it falls back to RSP/SPY.
Calculation
Smoothing Length (20) – higher = steadier regime; lower = faster.
Normalization Length (60) – window for 0–100 scaling in pillar tests.
Regime Timeframe (W) – lock regime to Weekly while viewing lower timeframes.
Visual
Ribbon Opacity controls how strong the background shading is.
Recommended usage
Apply the Ribbon to SPY/ES (broad beta) or IWM/RTY (small-cap rotation).
Pair it with the Mongoose Compass v2 panel in a separate pane for the full dashboard.
Limitations & disclaimer
For information and education; not investment advice.
Data availability varies by plan (especially futures and DSPX). Fallbacks apply automatically.
EMA HI/LO Cloud Shift + Extra EMA📌 EMA High/Low Buy-Sell Labels Indicator
This indicator generates simple Buy and Sell signals based on price interaction with two dynamic levels:
EMA High → Exponential Moving Average calculated from candle highs.
EMA Low → Exponential Moving Average calculated from candle lows.
🔑 How it Works
A Buy signal prints when the closing price crosses above the EMA High.
A Sell signal prints when the closing price crosses below the EMA Low.
Signals are marked directly on the chart with customizable labels — you can change the shape, size, and colors of the Buy and Sell labels to match your trading style.
The indicator does not plot the EMAs, keeping the chart clean and focused only on the entry/exit labels.
⚡ Use Case
Helps traders quickly identify potential trend breakouts (price strength above EMA High) or trend breakdowns (price weakness below EMA Low).
Works on any timeframe and any market (stocks, forex, crypto, futures, etc.).
Can be used standalone or combined with other indicators for confirmation.
🎯 Best For
Traders who want minimalist chart signals without clutter.
Trend-following strategies where confirmation of momentum is key.
Entry/Exit marking without needing to constantly watch EMA bands.
Futures Time Zones with Session SelectionMark the time period with color to help traders identify the trading range.
Z-Score Regression Bands [BOSWaves]Z-Score Regression Bands – Adaptive Trend and Volatility Insight
Overview
The Z-Score Regression Bands is a trend and volatility analysis framework designed to give traders a clear, structured view of price behavior. It combines Least Squares Moving Average (LSMA) regression, a statistical method to detect underlying trends, with Z-Score standardization, which measures how far price deviates from its recent average.
Traditional moving average bands, like Bollinger Bands, often lag behind trends or generate false signals in noisy markets. Z-Score Regression Bands addresses these limitations by:
Tracking trends accurately using LSMA regression
Normalizing deviations with Z-Scores to identify statistically significant price extremes
Visualizing multiple bands for normal, strong, and extreme moves
Highlighting trend shifts using diamond markers based on Z-Score crossings
This multi-layered approach allows traders to understand trend strength, detect overextensions, and identify periods of low or high volatility — all from a single, clear chart overlay. It is designed for traders of all levels and can be applied across scalping, day trading, swing trading, and longer-term strategies.
Theoretical Foundation
The Z-Score Regression Bands are grounded in statistical and trend analysis principles. Here’s the idea in plain terms:
Least Squares Moving Average (LSMA) – Unlike standard moving averages, LSMA fits a straight line to recent price data using regression. This “best-fit” line shows the underlying trend more precisely and reduces lag, helping traders see trend changes earlier.
Z-Score Standardization – A Z-Score expresses how far the LSMA is from its recent mean in standard deviation units. This shows whether price is unusually high or low, which can indicate potential reversals, pullbacks, or acceleration of a trend.
Multi-Band Structure – The three bands represent: Band #1: Normal range of price fluctuations; Band #2: Significant deviation from the trend; Band #3: Extreme price levels that are statistically rare. The distance between bands dynamically adapts to market volatility, allowing traders to visualize expansions (higher volatility) and contractions (lower volatility).
Trend Signals – When Z-Score crosses zero, diamonds appear on the chart. These markers signal potential trend initiation, continuation, or reversal, offering a simple alert for shifts in market momentum.
How It Works
The indicator calculates and plots several layers of information:
LSMA Regression (Trend Detection)
Computes a line that best fits recent price points.
The LSMA line smooths out minor fluctuations while reflecting the general direction of the market.
Z-Score Calculation (Deviation Measurement)
Standardizes the LSMA relative to its recent average.
Positive Z-Score → LSMA above average, negative → LSMA below average.
Helps identify overbought or oversold conditions relative to the trend.
Multi-Band Construction (Volatility Envelope)
Upper and lower bands are placed at configurable multiples of standard deviation.
Band #1 captures typical price movement, Band #2 signals stronger deviation, Band #3 highlights extreme moves.
Bands expand and contract with volatility, giving an intuitive visual guide to market conditions.
Trend Signals (Diamonds)
Appear when Z-Score crosses zero.
Indicates moments when momentum may shift, helping traders time entries or exits.
Visual Interpretation
Band width = volatility: wide bands indicate strong movement; narrow bands indicate calm periods.
LSMA shows underlying trend direction, while bands show how far price has strayed from that trend.
Interpretation
The Z-Score Regression Bands provide a multi-dimensional view of market behavior:
Trend Analysis – LSMA line slope shows general market direction.
Momentum & Volatility – Z-Score indicates whether the trend is accelerating or losing strength; band width indicates volatility levels.
Price Extremes – Price touching Band #2 or #3 may suggest overextension and potential reversals.
Trend Shifts – Diamonds signal statistically significant changes in momentum.
Cycle Awareness – Standard deviation bands help distinguish normal market fluctuations from extreme events.
By combining these insights, traders can avoid false signals and react to meaningful structural shifts in the market.
Strategy Integration
Trend Following
Enter trades when diamonds indicate momentum aligns with LSMA direction.
Use Band #1 and #2 for stop placement and partial exits.
Breakout Trading
Watch for narrow bands (low volatility) followed by price pushing outside Band #1 or #2.
Confirm with Z-Score movement in the breakout direction.
Mean Reversion/Pullback
If price reaches Band #2 or #3 without continuation, expect a pullback toward LSMA.
Exhaustion & Reversals
Flattening Z-Score near zero while price remains at extreme bands signals trend weakening.
Tighten stops or scale out before a potential reversal.
Multi-Timeframe Confirmation
High timeframe LSMA confirms the main trend.
Lower timeframe bands provide refined entry and exit points.
Technical Implementation
LSMA Regression : Best-fit line minimizes lag and captures trend slope.
Z-Score Standardization : Normalizes deviation to allow consistent interpretation across markets.
Multi-Band Envelope : Three layers for normal, strong, and extreme deviations.
Trend Signals : Automatic diamonds for Z-Score zero-crossings.
Band Fill Options : Optional shading to visualize volatility expansions and contractions.
Optimal Application
Asset Classes:
Forex : Capture breakouts, overextensions, and trend shifts.
Crypto : High-volatility adaptation with adjustable band multipliers.
Stocks/ETFs : Identify trending sectors, reversals, and pullbacks.
Indices/Futures : Track cycles and structural trends.
Timeframes:
Scalping (1–5 min) : Focus on Band #1 and trend signals for fast entries.
Intraday (15m–1h) : Use Bands #1–2 for continuation and breakout trades.
Swing (4h–Daily) : Bands #2–3 capture trend momentum and exhaustion.
Position (Daily–Weekly) : LSMA trend dominates; Bands #3 highlight regime extremes.
Performance Characteristics
Strong Performance:
Trending markets with moderate-to-high volatility
Assets with steady liquidity and identifiable cycles
Weak Performance:
Flat or highly choppy markets
Very short timeframes (<1 min) dominated by noise
Integration Tips
Combine with support/resistance, volume, or order flow analysis for confirmation.
Use bands for stops, targets, or scaling positions.
Apply multi-timeframe analysis: higher timeframe LSMA confirms main trend, lower timeframe bands refine entries.
Disclaimer
The Z-Score Regression Bands is a trading analysis tool, not a guaranteed profit system. Its effectiveness depends on market conditions, parameter selection, and disciplined risk management. Use it as part of a broader trading strategy, not in isolation.
Volume Percentile Supertrend [BackQuant]Volume Percentile Supertrend
A volatility and participation aware Supertrend that automatically widens or tightens its bands based on where current volume sits inside its recent distribution. The goal is simple: fewer whipsaws when activity surges, faster reaction when the tape is quiet.
What it does
Calculates a standard Supertrend framework from an ATR on a volume weighted price source.
Measures current volume against its recent percentile and converts that context into a dynamic ATR multiplier.
Widens bands when volume is unusually high to reduce chop. Tightens bands when volume is unusually low to catch turns earlier.
Paints candles, draws the active Supertrend line and optional bands, and prints clear Long and Short signal markers.
Why volume percentile
Fixed ATR multipliers assume all bars are equal. They are not. When participation spikes, price swings expand and a static band gets sliced.
Percentiles place the current bar inside a recent distribution. If volume is in the top slice, the Supertrend allows more room. If volume is in the bottom slice, it expects smaller noise and tightens.
This keeps the same playbook usable across busy sessions and sleepy ones without constant manual retuning.
How it works
Volume distribution - A rolling window computes the Pth percentile of volume. Above that is flagged as high volume. A lower reference percentile marks quiet bars.
Dynamic multiplier - Start from a Base Multiplier. If bar is high volume, scale it up by a function of volume-to-average and a Sensitivity knob. If bar is low volume, scale it down. Smooth the result with an EMA to avoid jitter.
VWMA source - The price input for bands is a short volume weighted moving average of close. Heavy prints matter more.
ATR envelope - Compute ATR on your length. UpperBasic = VWMA + Multiplier x ATR. LowerBasic = VWMA - Multiplier x ATR.
Trailing logic - The final lines trail price so they only move in a direction that preserves Supertrend behavior. This prevents sudden flips from transient pokes.
Direction and signals - Direction flips when price crosses through the relevant trailing line. SupertrendLong and SupertrendShort mark those flips. The plotted Supertrend is the active trailing side.
Inputs and what they change
Volume Lookback - Window for percentile and average. Larger window = stabler percentile, smaller = snappier.
Volume Percentile Level - Threshold that defines high volume. Example 70 means top 30 percent of recent bars are treated as high activity.
Volume Sensitivity - Gain from volume ratio to the dynamic multiplier. Higher = bands expand more when volume spikes.
VWMA Source Length - Smoothing of the volume weighted price source for the bands.
ATR Length - Standard ATR window. Larger = slower, smaller = quicker.
Base Multiplier - Core band width before volume adjustment. Think of this as your neutral volatility setting.
Multiplier Smoothing - EMA on the dynamic multiplier. Reduces back and forth changes when volume oscillates around the threshold.
Show Supertrend on chart - Toggles the active line.
Show Upper Lower Bands - Draws both sides even when inactive. Good for context.
Paint candles according to Trend - Colors bars by trend direction.
Show Long and Short Signals - Prints 𝕃 and 𝕊 markers at flips.
Colors - Choose your long and short palette.
Reading the plot
Supertrend line - Thick line that hugs price from above in downtrends and from below in uptrends. Its distance breathes with volume.
Bands - Optional upper and lower rails. Useful to see the inactive side and judge how wide the envelope is right now.
Signals - 𝕃 prints when the trend flips long. 𝕊 prints when the trend flips short.
Candle colors - Quick bias read at a glance when painting is enabled.
Typical workflows
Trend following - Use 𝕃 flips to initiate longs and ride while bars remain colored long and price respects the lower trailing line. Mirror for shorts with 𝕊 and the upper trailing line. During high volume phases the line will give more room, which helps stay in the move.
Pullback adds - In an established trend, shallow tags toward the active line after a high volume expansion can be add points. The dynamic envelope adjusts to the session so your add distance is not fixed to a stale volatility regime.
Mean reversion filter - In quiet tape the multiplier contracts and flips come earlier. If you prefer fading, watch for quick toggles around the bands when volume percentile remains low. In high volume, avoid fading into the widened line unless you have other strong reasons.
Notes on behavior
High volume bar: the percentile gate opens, volRatio > 1 powers up the multiplier through the Sensitivity lever, bands widen, fewer false flips.
Low volume bar: multiplier contracts, bands tighten, flips can happen earlier which is useful when you want to catch regime changes in quiet conditions.
Smoothing matters: both the price source (VWMA) and the multiplier are smoothed to keep structure readable while still adapting.
Quick checklist
If you see frequent chop and today feels busy: check that volume is above your percentile. Wider bands are expected. Consider letting the trend prove itself against the expanded line before acting.
If everything feels slow and you want earlier entries: percentile likely marks low volume, so bands tighten and 𝕃 or 𝕊 can appear sooner.
If you want more or fewer flips overall: adjust Base Multiplier first. If you want more reaction specifically tied to volume surges: raise Volume Sensitivity. If the envelope breathes too fast: raise Multiplier Smoothing.
What the signals mean
SupertrendLong - Direction changed from non-long to long. 𝕃 marker prints. The active line switches to support below price.
SupertrendShort - Direction changed from non-short to short. 𝕊 marker prints. The active line switches to resistance above price.
Trend color - Bars painted long or short help validate context for entries and management.
Summary
Volume Percentile Supertrend adapts the classic Supertrend to the day you are trading. Volume percentile sets the mood, sensitivity translates it into dynamic band width, and smoothing keeps it clean. The result is a single plot that aims to stay conservative when the tape is loud and act decisively when it is quiet, without you having to constantly retune settings.