SPX / Silver (XAGUSD) RatioThis script visualizes the S&P 500 Index to Silver ratio (SPX/Silver) — a powerful tool for monitoring the relative strength of equities vs. precious metals over time.
📊 Use Case:
Helps traders assess macro sentiment shifts between risk-on (equities) and risk-off (commodities).
A rising ratio indicates equity outperformance vs Silver, often in growth-driven bull markets.
A falling ratio suggests Silver is outperforming — potentially due to inflation, geopolitical risk, or weakening equities.
⚙️ Data & Calculation:
SPX: SP:SPX (S&P 500 Index)
Silver: TVC:SILVER
Formula:
SPX / Silver
(Both are spot/index prices, updated on daily timeframe)
📈 Interpretation:
📈 Ratio Rising → SPX outperforming Silver → Risk-on sentiment
📉 Ratio Falling → Silver outperforming SPX → Possible flight to safety or inflation hedge
🧠 Ideal For:
Macro trend analysis
Intermarket strategy development
Asset rotation decision-making
Spotting Silver bottoms during SPX/Silver peak zones
Motifs graphiques
ICT London & NY Kill ZonesICT london and NYC kiill zones marked on the chart automatically - use with NY time zone
ICT Kill zones ver 2ICT Kill zones :
London 02:00 - b5:00
NY 7:00 -10:00
NY Lunch
13:00 - 14:30
*all times are NYC times
SECTOR ROTATION Sector Rotation Indicator with Auto Chart Symbol
This indicator helps traders track relative performance across multiple indices/sectors simultaneously, making it easy to identify sector rotation and market leadership.
Key Features:
✅ 21 Symbols Tracking: Monitor 20 customizable symbols + your current chart symbol automatically(DIVIDEND SYMBOL)
✅ Percentage Performance: All moving averages show percentage gain/loss from 1 timeframe period ago
✅ Color-Coded Visualization: Heat map coloring (red to green) based on relative performance ranking
✅ Flexible Timeframes: Works on any timeframe from 1-minute to 12-month charts
✅ Performance Table: Quick-view table showing candle performance with inside/outside bar detection
✅ Indian Market Ready: Pre-configured with NSE indices (NIFTY, BANKNIFTY, and sectoral indices)
Default Symbols (Customizable):
NIFTY, CNXSMALLCAP, CNXMIDCAP, BANKNIFTY
Sector indices: IT, AUTO, PHARMA, METAL, ENERGY, FMCG, etc.
Plus your current chart symbol (automatically added)
How It Works:
Select your preferred timeframe (1D, 1W, 1M, etc.)
The indicator calculates percentage performance from given period ago
Moving averages show smoothed performance trends
Colors indicate relative strength: Green = outperformers, Red = underperformers
Perfect For:
Sector rotation analysis
Relative strength comparison
Market breadth assessment
Index/ETF traders
Swing and position traders
Settings:
Adjustable MA length (default: 20)
Customizable colors and table position
Show/hide percentage labels
Horizontal or vertical table layout
This is not any buy or sell signal or recommendation, consult with your advisor first.
DAX Zonen Ergänzungen (Pro Signale + EMAs mit Filter RSI MACD)📊 DAX Zones Enhancements (Pro Signals + EMA with RSI & MACD Filter)
Description:
This indicator enhances DAX trading analysis by combining dynamic support/resistance zones with professional-level signal filters. It automatically detects potential buy and sell zones and confirms them using EMA trends, RSI conditions, and MACD momentum.
Key features:
🔹 Visual display of DAX high- and low-price zones
🔹 EMA-based trend confirmation
🔹 RSI and MACD filters to reduce false signals
🔹 Customizable alerts when price interacts with key zones
🔹 Works on multiple timeframes
Ideal for traders who want a clean, rule-based approach to identifying high-probability entries and exits on the DAX index.
Current Weekly Open LineThis indicator is an indicator to make your weekly review.
It shows exactly where the last weekly open candle has been, so you don't have to search it manually.
Current Weekly Open LineVertical line on current weekly open.
To know exactly on every chart where the current weekly opening is, without having to do it manually.
TTM Squeeze Pro - IntradayTTM Squeeze Pro – Intraday (AI MTF Edition)
Design Rationale
This indicator is built to help traders identify when markets are consolidating, when volatility is building (squeeze), and when a breakout or trend is starting — all across multiple timeframes.
The design combines three powerful ideas:
Volatility Compression & Expansion (TTM Squeeze Logic):
By comparing Bollinger Bands (BB) and Keltner Channels (KC), the indicator detects when volatility contracts (BB inside KC). These moments often precede explosive moves. White dots on the BB basis line mark these “squeeze” periods.
Trend Strength & Direction (ADX System):
The ADX (Average Directional Index) measures how strong a trend is.
ADX rising above the threshold → trending market.
ADX falling below the threshold → consolidation.
The system classifies each bar as Trending Up, Trending Down, Consolidating, or Neutral, depending on ADX and momentum direction.
Multi-Timeframe (MTF) Alignment:
The same logic is applied to several timeframes (1m, 3m, 5m, 15m, 30m, 1h).
A compact table at the top-right shows each timeframe’s trend and squeeze strength.
This helps traders see whether short-term and higher timeframes are aligned, improving trade confidence and timing.
The AI Enhancer automatically adjusts all parameters (ADX, BB, KC lengths, and thresholds) depending on the current chart timeframe, keeping signals consistent between scalping and swing trading setups.
Trend and squeeze strengths are normalized on a 1–9 scale, giving users a quick numerical sense of trend power and squeeze intensity. The design emphasizes clarity, speed, and adaptability — critical for intraday trading decisions.
How to Use
Identify a Squeeze Setup:
Look for white dots on the chart — this marks low volatility and potential energy buildup.
Wait for Breakout Confirmation:
When the white dots disappear, volatility expands.
Check the MTF table — if multiple timeframes show green (uptrend) or red (downtrend) in the “TR” column, momentum is aligning.
Enter the Trade:
Go long if breakout happens above BB basis and most timeframes show green.
Go short if breakout happens below BB basis and most timeframes show red.
Exit or Manage Position:
When new white dots appear → volatility contracting again → consider exiting or tightening stops.
If MTF colors become mixed → trend losing strength.
In Summary
The TTM Squeeze Pro – Intraday AI MTF Indicator blends volatility analysis, trend strength, momentum, and multi-timeframe alignment into one adaptive tool.
Its design aims to simplify complex market behavior into a visual, data-backed format — enabling traders to catch high-probability breakout trends early and avoid false moves during low-volatility phases.
A+ Confluence Alert (BTC filter) — Kailash//@version=5
indicator("A+ Confluence Alert (BTC filter) — Kailash", overlay=true)
// === USER INPUTS ===
btcTicker = input.symbol("BINANCE:BTCUSDT", "BTC symbol (for bias filter)")
btcHTF = input.timeframe("60", "BTC Higher TF (for bias)") // 1H
localHTF = input.timeframe("15", "Local bias TF") // 15m
ema_fast_len = input.int(20, "EMA fast length")
ema_slow_len = input.int(50, "EMA slow length")
vol_sma_len = input.int(20, "Volume SMA length")
vol_mult = input.float(1.5, "Volume spike multiplier", step=0.1)
liquidity_look = input.int(12, "Liquidity sweep lookback (bars)")
session_filter = input.bool(true, "Use session filter (NY window)")
ny_start = input.session("1300-2000", "NY session (UTC)")
// === FETCH BTC HIGHER-TF BIAS ===
btc_close_htf = request.security(btcTicker, btcHTF, close, lookahead=barmerge.lookahead_off)
btc_ema_fast = request.security(btcTicker, btcHTF, ta.ema(close, ema_fast_len), lookahead=barmerge.lookahead_off)
btc_ema_slow = request.security(btcTicker, btcHTF, ta.ema(close, ema_slow_len), lookahead=barmerge.lookahead_off)
btc_bias_long = btc_ema_fast > btc_ema_slow
btc_bias_short= btc_ema_fast < btc_ema_slow
// === LOCAL BIAS (on localHTF) for current chart symbol ===
local_close = request.security(syminfo.tickerid, localHTF, close, lookahead=barmerge.lookahead_off)
local_ema_f = request.security(syminfo.tickerid, localHTF, ta.ema(close, ema_fast_len), lookahead=barmerge.lookahead_off)
local_ema_s = request.security(syminfo.tickerid, localHTF, ta.ema(close, ema_slow_len), lookahead=barmerge.lookahead_off)
local_long = local_ema_f > local_ema_s
local_short = local_ema_f < local_ema_s
// === VOLUME SPIKE ===
vol_sma = ta.sma(volume, vol_sma_len)
vol_spike = volume > vol_sma * vol_mult
// === SIMPLE LIQUIDITY SWEEP DETECTION (proxy) ===
// Long-sweep: price made new local low (below recent lowest) and then reclaimed above that prior low.
// Short-sweep: symmetrical for highs.
recent_low = ta.lowest(low, liquidity_look)
recent_high = ta.highest(high, liquidity_look)
sweep_long = (low < recent_low ) and (close > recent_low ) // low punched lower, then close reclaimed
sweep_short= (high > recent_high ) and (close < recent_high ) // high pumped, then reclaimed down
// === ORDER-BLOCK RECLAIM PROXY ===
// Define last opposite directional candle high/low as "OB"
var float ob_high = na
var float ob_low = na
// Update order blocks when opposite direction candles form
if close < open // bearish candle
ob_high := high
if close > open // bullish candle
ob_low := low
// Reclaim conditions: price closes above recent bearish-high (for long), or below recent bullish-low (for short)
reclaim_long = not na(ob_high) and close > ob_high
reclaim_short = not na(ob_low) and close < ob_low
// === SESSION FILTER ===
in_session = true
if session_filter
in_session := not na(time(timeframe.period, ny_start))
// === FULL CONFLUENCE LOGIC ===
// Long confluence: BTC bias long, local bias long, sweep_long or reclaim_long, volume spike, in session
long_confluence = btc_bias_long and local_long and (sweep_long or reclaim_long) and vol_spike and in_session
// Short confluence: BTC bias short, local bias short, sweep_short or reclaim_short, volume spike, in session
short_confluence = btc_bias_short and local_short and (sweep_short or reclaim_short) and vol_spike and in_session
// === PLOTTING SIGNALS ON CHART ===
plotshape(long_confluence, title="A+ Long", style=shape.labelup, location=location.belowbar, color=color.green, size=size.small, text="A+ Long")
plotshape(short_confluence, title="A+ Short", style=shape.labeldown, location=location.abovebar, color=color.red, size=size.small, text="A+ Short")
// === ALERTS ===
alertcondition(long_confluence, title="A+ Confluence Long", message="A+ LONG: BTC bias long, local bias long, sweep/OB reclaim + volume spike. Symbol: {{ticker}}. Time: {{time}}")
alertcondition(short_confluence, title="A+ Confluence Short", message="A+ SHORT: BTC bias short, local bias short, sweep/OB reclaim + volume spike. Symbol: {{ticker}}. Time: {{time}}")
// === INFO BOX ===
var label info = na
if barstate.islast
label.delete(info)
info := label.new(x=bar_index, y=high, yloc=yloc.abovebar, style=label.style_label_left, text=
"A+ Long: " + (long_confluence ? "YES" : "NO") + " " +
"A+ Short: " + (short_confluence ? "YES" : "NO") + " " +
"BTC HTF Bias: " + (btc_bias_long ? "LONG" : btc_bias_short ? "SHORT" : "NEUTRAL") + " " +
"Local Bias: " + (local_long ? "LONG" : local_short ? "SHORT" : "NEUTRAL") + " " +
"VolSpike: " + (vol_spike ? "YES" : "NO"),
color=color.new(color.blue, 80), textcolor=color.white)
MACD with Smart Entry Signals & Trend Filter
This advanced MACD indicator combines traditional MACD analysis with intelligent entry signal detection and an optional EMA trend filter. It identifies high-probability entry points by analyzing histogram patterns, consolidation phases, and trend continuation setups.
### Key Features
**🎯 Smart Entry Detection**
- **Consolidation Breakouts**: Identifies exits from consolidation zones (weak bars) with strong momentum
- **Trend Reversals**: Detects potential trend changes after extended weak phases
- **Correction/Continuation Patterns**: Recognizes brief corrections within strong trends that offer continuation opportunities
**📊 Enhanced MACD Visualization**
- Color-coded histogram showing four distinct states:
- Strong Bullish (dark green): Rising histogram above zero
- Weak Bullish (light green): Falling histogram above zero
- Weak Bearish (light red): Rising histogram below zero
- Strong Bearish (dark red): Falling histogram below zero
**🔍 Multi-Layer Filtering System**
- **Candle Size Filter**: Eliminates signals during high volatility/large candle ranges
- **EMA Trend Filter**: Optional filter ensuring entries align with the dominant trend direction
- Visual markers for rejected signals (orange X for candle size, blue E for EMA trend)
**⚙️ Customizable Parameters**
- Adjustable MACD periods (default: 34/144/9)
- Configurable consolidation bar requirements
- Flexible correction pattern detection
- EMA trend filter with adjustable sensitivity
- Multiple alert types for all signal conditions
### How to Use
1. **Enable/disable filters** based on your trading style and market conditions
2. **Green triangles (L)**: Long entry signals when all conditions are met
3. **Red triangles (S)**: Short entry signals when all conditions are met
4. **Rejected signal markers**: Help you understand why certain setups were filtered out
5. **Background coloring**: Provides visual confirmation of signal zones and correction patterns
### Alert System
Comprehensive alerts for:
- Long and short entry signals
- Specific pattern types (consolidation, reversal, continuation)
- Rejected signals (helps refine strategy)
- Traditional MACD histogram crossovers
### Best Practices
- Use the EMA trend filter in trending markets to avoid counter-trend trades
- Adjust candle size filter based on your instrument's typical volatility
- Consider combining with support/resistance levels for confirmation
- Test different consolidation bar settings for your timeframe
### Parameters Summary
- Fast/Slow Length: MACD calculation periods
- Signal Smoothing: Signal line period
- Consolidation Bars: Minimum weak bars before breakout
- Max Candle Range: Filter for oversized candles
- EMA Period & Sensitivity: Trend filter configuration
---
*This indicator is designed for traders who want a systematic approach to identifying MACD-based entry opportunities with built-in risk management through filtering.*
Time Period Highlighter (UTC) — SPARTANHighlights sessions
00:00 UTC - 06:00 UTC
06:00 UTC - 12:00 UTC
12:00 UTC - 12:00 UTC
Ikas Forex SM ConceptsIkas Forex SM Concepts (SMC) – All-in-One Indicator
This indicator automatically analyzes market structure, liquidity zones, and institutional trading areas, allowing you to interpret price movements using the “Smart Money Concepts” approach.
It directly plots the most important concepts such as real-time BOS (Break of Structure), CHoCH (Change of Character), Order Block, Fair Value Gap (FVG), Equal High/Low, and Premium/Discount zones onto the chart.
⚙️ Features
Intra & Swing Market Structure: Shows micro and macro breaks (BOS/CHoCH) in price movement in real time.
Order Blocks: Marks potential areas where institutional participants open positions (bull/bear blocks).
Fair Value Gaps: Automatically detects price imbalances, identifies potential entry/exit zones.
Equal Highs & Lows (EQH/EQL): Highlights double top/bottom formations, visualizes potential liquidity traps.
Premium & Discount Zones: Shows whether the price is in an overvalued (premium) or undervalued (discount) zone.
MTF High/Low Levels: Automatically plots daily, weekly, and monthly high-low levels.
Style and Filtering: Offers flexible options such as color or monochrome views, BOS filtering, and FVG threshold settings.
📊 How to Use?
Trend Direction: CHoCH and BOS labels help identify trend reversals and continuations.
Liquidity Zones: Order blocks and equal high/low levels clarify institutional liquidity zones.
Entry/Exit Planning: When combined with FVG and Premium/Discount zones, high-probability trade points can be identified.
Chart Cleanliness: Since all these components are drawn automatically, the manual analysis burden is reduced.
💡 Why is it important?
Smart Money Concepts (SMC) is an approach popularized by ICT that analyzes price movement not only with formations but also with liquidity and market structure dynamics.
This indicator combines these concepts into a single tool, providing a visual, simple, and functional analysis environment.
Stop point MMAAn indicator that determines an important stopping area by overcoming the blue candle. The overriding party is determined by buyers or sellers, as it must be confirmed by two candles closing below
Pullback Finder AutoPullback Finder Auto — Intraday Momentum Cooling Detector
Pullback Finder Auto is designed to find stocks that have made a strong intraday run from the open and are now cooling off while still positive — the classic pullback zone where continuation entries often form.
It automatically measures the percentage change from today’s open and highlights bars where:
the stock has already run at least a chosen amount (for example +10 % above its open), and
the current price is still up but within a defined pullback range (for example between +3 % and +8 % above the open).
When those two conditions are met, you’ll see green graphics on your chart:
Green triangle markers under the candle.
Optionally, small green PB labels such as “PB 5.2 %” showing the exact percentage from open when the setup occurs.
A green highlight in the sub‑window or line plot if you left the “Change from Open %” plot active.
These are your visual cues that a pullback has formed — a stock that previously ran and is now pulling back while holding strength.
How it works
The script continuously monitors:
• High % from Open = (high − open) / open × 100
• Current % from Open = (close − open) / open × 100
A “Pullback” condition triggers only if:
the high % is greater than or equal to your minimum run threshold, and
the current % sits between your minimum and maximum pullback percentages.
When both are true, the indicator plots the green triangle and optional label.
Default parameters
Min Run % = 10
Min Current % = 3
Max Current % = 8
Session Start = 09:30 – 16:00 US Eastern
All can be changed to fit different volatility levels.
Lower values catch smaller moves; higher values restrict signals to explosive runners.
Using it in real time
During live trading, Pullback Finder Auto updates with each candle.
When a bar first enters the target zone, a green triangle and PB label will appear immediately under that candle.
These are dynamic: if price moves out of the valid zone on the same bar, the marker may disappear.
You can create an alert on “Pullback Finder Auto – Pullback Candidate” to be notified whenever new triangles appear across your active symbols.
This works on any timeframe:
use shorter timeframes such as 1‑minute or 5‑minute charts for fast, intraday detection,
use longer timeframes for a broader view of the day’s market structure.
Using it on past data (scanning backwards)
When you scroll back through history, past green triangles remain visible at every bar where the condition was true at that time.
The PB labels next to those candles show exactly how far above the open the stock was trading during the historical setup.
Use this for visual back‑testing: study how price reacted after these pullback points, adjust the thresholds, and refine your criteria for different markets.
The grey or teal line under the chart (if enabled) shows the percent‑from‑open curve so you can see the full run‑and‑cool pattern leading into each triangle signal.
If you convert the indicator into a strategy, the same condition becomes historical entry points you can test with the Strategy Tester.
Summary
1. Pullback Finder Auto paints green triangles and PB labels whenever an intraday pullback fits your criteria.
2. It runs dynamically in real‑time and also preserves markers for historical review.
3. Adjust the thresholds to match volatility or timeframe.
4. Ideal for visual scanning, watchlist alerts, or integration into a lightweight screening strategy.
Kelly Wave Position Matrix 20251024 V1 ZENYOUNGA simple table is designed for use when opening a position. It applies the Kelly formula to calculate a more scientific position size based on win rate and risk–reward ratio. At the same time, it displays 1.65× ATR stop-loss levels for both long and short positions to serve as a reference for comparing with existing stop-loss placements.
Additionally, the table back-calculates the corresponding position size based on a 2% total capital loss limit, using the actual loss ratio. It also shows the current wave trend status as a pre-filtering condition.
Overall, this table integrates the core elements of trading — trend (wave confirmation), win rate, risk–reward ratio, and position sizing — making it an effective checklist before entering a trade. Its purpose is to help achieve a probabilistic edge and ensure positive expected value in trading decisions.
Avivso 150 + ATHThis Pine Script displays a dynamic on-chart watermark and key stock data.
It shows company info, symbol, industry, market cap, ATR(14) with color status, earnings countdown, and distances from the current price to SMA150 and the all-time high.
It also plots SMA 20 and SMA 150 moving-average lines on the chart and supports configurable position, size, and padding for the watermark.
20 EMA Undercut Bounce - M4v3r1ck💎 The "EMA Undercut Bounce" Bullish Scanner
This indicator is designed to identify high-conviction continuation patterns where price makes a temporary dip for liquidity before resuming a powerful, established uptrend. It specifically looks for a bullish rejection off the 20-period Exponential Moving Average (EMA).
🎯 Strategy Logic
The signal is generated only on the Daily (1D) timeframe when the following five precise conditions are met on the most recent completed bar:
1. Price Action (The Undercut Bounce)
• Undercut: The bar's low price must have touched or temporarily traded below the 20-Day EMA.
• Rejection: The bar's close price must have fully recovered and closed above the 20-Day EMA. This is the classic sign of strong buying pressure defending a key support level.
2. Strong Trend Hierarchy (The Bullish Stack)
The moving averages must be perfectly stacked, confirming a robust multi-timeframe uptrend structure:
• 10-Day EMA > 20-Day EMA
• 20-Day EMA > 50-Day SMA
• 50-Day SMA > 200-Day SMA
3. Momentum Confirmation (The Upward Slope)
Both the 10-Day EMA and the 20-Day EMA must be rising from the previous day. This ensures that the short-term trend momentum is positive, ruling out signals during flat or turning markets.
💡 How to Use This Indicator
1. Timeframe: Ensure your chart is set to the Daily (1D) timeframe for accurate results.
2. Signal: A Green Background highlight and an Up-Arrow below the bar mark a confirmed signal.
3. Alerts: Use the built-in alert condition to set up notifications for stocks on your watchlist, allowing you to catch these high-quality setups without constantly monitoring charts.
This script is ideal for trend-following traders looking to enter a position after a healthy shakeout and confirmation of continued bullish commitment.
Unicorn Trade Indicator - Enhanced V1This code also contains pinescripts from iFVG (BPR) by Algorize and Visualizing displacement by tradeforopp who have kindly provided them as open source.
An ICT Unicorn is where a breaker block is traded through which incorporates a fair value gap. I decided to code this indicator as I couldn't find an existing free indicator on Trading View that performed adequately.
This indicator will highlight breaker blocks and when broken will post an Unicorn emoji and send an alert if requested. The last 3 breaker blocks are displayed, the prior boxes are labled PBB and are shown as red for bearish and green for bullish. After the main Unicorn is posted, the code continues to mark market structure shifts.
As all trading strategies work better with confluence I have added several other features which is very useful for people who are restricted on the number of indicators that can place on a single chart.
I have added iFVG (BPR) by Algoryze and Visualizing displacement by tradeforopp which have kindly been made open source by the authors. My thanks to them for their hard work.
Unicorn alerts will only be sent when a yellow displacement candle ( from the Visualizing displacement code) is present along with the Unicorn as this is the best type of Unicorn to trade.
The number of fvg's and bpr's from the code by Algoryze can be adjusted in the settings.
Also to add confluence I have used my own code to display liquidity depth boxes made popular by toodegrees.
I hope you find this indicator useful.
Julius Single TrailJulius Single Trail — How it works
This indicator combines a Kalman-like smoothed Donchian midline with an ATR-style volatility buffer to create a single adaptive trailing line that flips with trend. It also recolors candles to reflect regime and visually marks ranging conditions using Bollinger Band width. Optionally, it adds a dotted price line and can hide default candles for a clean, unified look.
Core logic
Donchian midpoint: Calculates the middle of the highest high and lowest low over Donchian Length. This is the directional anchor.
Kalman-like smoothing: Applies a lightweight exponential update to the Donchian midpoint using Alpha, reducing noise while staying responsive.
Volatility buffer: Uses RMA of True Range over Volatility Length multiplied by Volatility Multiplier to form an adaptive offset around the smoothed midline.
Dynamic trail:
Up-trend regime (regime = 1): The trail is kMid - offset and only ratchets upward (math.max), acting like a long stop.
Down-trend regime (regime = -1): The trail is kMid + offset and only ratchets downward (math.min), acting like a short stop.
Flip conditions: Regime flips only when price is on the far side of both the smoothed midpoint and the current trail:
Flip to down when close < kMid and close < dynTrail
Flip to up when close > kMid and close > dynTrail
Candle styling:
Wick color shows immediate price direction (green for bullish, red for bearish).
Body color follows the trail’s regime (Uptrend Color or Downtrend Color).
In ranging conditions, all candle elements turn gray.
Ranging detection:
Computes Bollinger Bands on close with BB Length and BB Multiplier.
Calculates width as a percentage of the basis. If width% (optionally smoothed) is below Range Threshold %, candles are gray to signal consolidation.
What it plots
Dynamic Trail: A single, thick line that changes color by regime:
Uptrend: Uptrend Color (default lime)
Downtrend: Downtrend Color (default red)
Optional Trail Fill to Close: A translucent band between the trail and the close (disabled by default).
Optional Dotted Price Line: A dotted horizontal line at the current price (toggle via Show Dotted Price Line).
Candle treatment:
You can hide default candles (Hide Default Candles), then use a separate custom-candle script for wick/body/border mapping. In this script, default candles can be made fully transparent to let the trail and colors dominate.
Inputs
Donchian Length: Window for the highest/lowest used to form the midline.
Kalman Alpha 0–1: Smoothing factor for the midline. Higher = more responsive, lower = smoother.
Volatility Length: RMA length of True Range for the volatility buffer.
Volatility Multiplier: Scales the buffer around the midline. Higher widens the trail, reducing flips.
Uptrend Color / Downtrend Color: Trail and body color by regime.
Show Cloud To Close: Fills between price and trail using the trail’s color.
Hide Default Candles: Makes the native candles fully transparent.
Show Dotted Price Line / Price Line Color: Toggles and colors the dotted price line.
Ranging parameters:
BB Length (Ranging) and BB Multiplier (Ranging): Bollinger Band settings.
Range Threshold %: If BB width% < threshold, candles turn gray to indicate range.
Use Smoothed Width / Width Smoothing Length: Smooths BB width% before comparison.
Signals and interpretation
Regime shifts:
Bullish flip: When price closes above both the smoothed midpoint and the current trail. Trail switches to the lower band (kMid - offset) and ratchets up.
Bearish flip: When price closes below both the smoothed midpoint and the current trail. Trail switches to the upper band (kMid + offset) and ratchets down.
Trend bias:
Green trail/body: Favor long bias; trail can serve as a dynamic stop.
Red trail/body: Favor short bias; trail can serve as a dynamic stop.
Ranging filter:
Gray candles: Lower-probability trend continuation; consider reducing position sizing, waiting for a breakout, or using mean-reversion tactics.
How to use it
Trend following:
Enter in the direction of the regime when flips occur or on pullbacks that respect the trail.
Use the trail as a stop-loss guide: exit when price closes beyond the trail and the regime flips.
Range awareness:
When candles turn gray, avoid trend entries or switch to range tactics. Wait for color to return and a clean flip.
Tuning suggestions:
Faster, more responsive: Lower Donchian Length, increase Alpha, lower Volatility Length and/or Volatility Multiplier.
Smoother, fewer flips: Increase Donchian Length, decrease Alpha, increase Volatility Length and/or Volatility Multiplier.
Ranging strictness: Increase Range Threshold % to mark ranges more often; smooth the width to avoid choppiness.
Example settings
Swing trading:
Donchian Length: 50
Alpha: 0.25
Vol Length: 14
Vol Mult: 1.6
BB Length: 20, BB Mult: 2.0, Range Threshold %: 2.0, Smoothed width ON (20)
Intraday (more responsive):
Donchian Length: 20–30
Alpha: 0.4–0.6
Vol Length: 10–14
Vol Mult: 1.2–1.6
Range Threshold %: 1.5–2.5 depending on instrument
Alerts (suggested)
Regime flips:
Condition: close > dynTrail and close > kMid -> Alert: Bullish regime
Condition: close < dynTrail and close < kMid -> Alert: Bearish regime
Range state:
Condition: BB width% < threshold -> Alert: Ranging
You can wire these using alertcondition() on the flip conditions and isRange variable inside the script.
Notes and limitations
This is a single-side ratcheting trail per regime, designed to reduce whipsaw by requiring price to clear both the midpoint and the trail before flipping.
Like all trend tools, it can lag tops/bottoms and may chop in low-volatility, sideways markets.
For assets with highly irregular volatility, retune Volatility Multiplier and Range Threshold %.
Short description (for header):
Adaptive, single-line trailing stop based on Kalman-smoothed Donchian mid + ATR-style buffer. Colors candles by regime, grays out ranges via BB width. Optional price line and cloud.
If you want, I can add alertcondition() for the flip and range events and a light custom-candle overlay so you can publish with built-in alert templates and consistent candle styling.
golden smart entrySmart Money Concepts (SMC) is a trading methodology that focuses on understanding and following the behavior of institutional investors—often referred to as "smart money." The goal is to identify high-probability trade setups by analyzing how these large players move the market.
First X Days Of A YearFirst X-Day Indicator
Overview
The "First X-Day Indicator" is a powerful tool to visualize and analyze market sentiment during the crucial first trading days of each new year. It provides immediate visual feedback on whether the year is starting with positive or negative momentum compared to the previous year's close, a concept often related to market theories like the "January Effect" or the "First Five Days Rule."
The indicator is designed to be clean, intuitive, and fully customizable to fit your charting style.
Key Features
Yearly Baseline: Automatically draws a horizontal line at the previous year's closing price. This line serves as a clear 0% reference for the current year's performance.
Dynamic Background Coloring: For a user-defined number of days at the start of the year, the chart background is colored daily. Green indicates the close is above the previous year's close, while red indicates it's below.
Final Performance Symbol: At the end of the analysis period (e.g., on the 5th day), a single summary symbol (like 👍 or 👎) appears. This symbol represents the final performance outcome of the initial trading period.
Settings & Customization
You have full control over all visual elements:
Analysis Period: Define exactly how many days at the start of the year you want to analyze (e.g., 3, 5, or 10 days).
Line Customization: Fully control the yearly baseline's appearance. You can change its color, width, and style (Solid, Dashed, or Dotted) or hide it completely.
Symbol Customization: Choose any character or emoji for the positive and negative performance symbols. You can also adjust their size (Small, Normal, Large) or hide them.
Background Control: Enable or disable the daily background coloring and select your preferred custom colors for positive and negative days.






















