OPEN-SOURCE SCRIPT
Aggiornato

Daily/Weekly Swing Highs-Lows + Candle Patterns

2 850
Description
Daily/Weekly Swing Highs-Lows + Candle Patterns

This indicator plots the most recent Daily and Weekly Swing Highs and Lows (key support/resistance levels) using a simple and effective logic: a swing high/low is confirmed when the previous bar's extreme is higher/lower than both the current and the one before it.

Features:
• Daily Swing Highs/Lows (teal/maroon circles) – toggleable
• Weekly Swing Highs/Lows (blue/purple circles) – optional
• Visual separators for new daily and weekly bars (light background color)
• Daily candle pattern labels (optional):
- US = Up Swing (strong bullish continuation)
- DS = Down Swing (strong bearish continuation)
- IN = Inside Bar
- OUT = Outside Bar
• Daily close position labels (optional):
- P = Positive (close in upper 25% of the range)
- mP = minor Positive (50–75%)
- mN = minor Negative (25–50%)
- N = Negative (lower 25%)

All elements are fully customizable (colors, visibility) and work on any timeframe.

Best suited for intraday timeframes (1 min to 4 hours) where daily and weekly key levels provide important context for price action and reversals.

The optional "Trading session length" input is mainly useful for markets with shorter sessions (e.g., European indices) and does not affect swing detection.

Open-source, free to use and modify.


How to Use the Indicator + Practical Use Case
Key Settings (Inputs)
Trading session length (hours) → Default 8.5 h (useful for FTSEMIB, DAX, etc.). Leave it as is unless you trade a market with a different session length.
Daily Swing Levels → Show/Hide daily swing highs (teal) and lows (maroon).
Weekly Swing Levels → Usually keep off on intraday charts to avoid clutter (turn on for higher-timeframe context).
Daily Candle Patterns → Enable only if you want to see US/DS/IN/OUT labels on the daily close.
Close Position (P/mP/mN/N) → Enable if you want to quickly see how strong/weak the daily close was.

What You See on the Chart
Teal circles = Last confirmed daily swing high (resistance).
Maroon circles = Last confirmed daily swing low (support).
Blue/purple circles (if enabled) = Weekly swing high/low.
Light gray background = Start of a new trading day.
Purple background (if weekly enabled) = Start of a new week.
Small labels on daily close (if enabled):
- US = strong bullish day
- DS = strong bearish day
- IN = inside bar (consolidation)
- OUT = outside bar (expansion)
- P/mP/mN/N = how far the close was from the high/low of the day.

Best Timeframes 1 min to 240 min charts → Daily levels act as major support/resistance zones for intraday trading.
Avoid using on daily or higher charts (the logic is designed for intraday context).

Why this works well intraday:
The daily swing high/low levels are high-probability zones where institutions and algorithms often defend positions. On intraday charts, they act as “magnets” for price, giving you clean entries and exits with clear invalidation levels.
This indicator keeps your chart clean while providing exactly the context most intraday traders need: key daily levels + daily momentum context.


Note di rilascio
What's New in This Version (Update Notes)

New Feature:
Volume-Based Conviction Coloring for Daily Swing Levels
This update introduces a subtle but powerful enhancement to the daily swing high/low circles by adding volume trend context to help assess the strength and reliability of each swing level.

Key changes and additions:
Volume Rate-of-Change (ROC) Filter – Now calculates a smoothed daily volume ROC to determine whether volume has been expanding or contracting in the recent period leading up to the swing formation.

Dynamic Transparency Coloring – Daily swing circles (both resistance and support) now adjust their opacity based on the prevailing volume trend:
- Bold/solid (low transparency) when volume is expanding (smoothed ROC > 0) → indicates higher conviction and institutional participation.
- Faded/semi-transparent (higher transparency) when volume is contracting (smoothed ROC ≤ 0) → suggests weaker or less convincing swings.

Fully Customizable – New inputs under the "Volume rate-of-change" group:
ROC Length (default: 10 days)
SMA Length for smoothing (default: 5 days)
Transparency levels for strong vs. weak volume states (default: 0 for strong, 50 for weak)

This addition helps traders quickly distinguish between high-probability swings backed by rising volume and potentially less reliable ones formed during volume dry-ups — all without adding clutter or extra plots.

All other original features remain unchanged:
Clean daily/weekly swing high/low levels
Optional US/DS/IN/OUT daily candle pattern labels
Close position labels (P/mP/mN/N)
New day/week background shading
Session length input (still present for future use)

This version keeps the indicator lightweight and focused while giving experienced traders an extra layer of confluence directly on the key levels.Ideal for intraday traders who want to prioritize bounces or breaks at swings formed with genuine volume support.

Open-source as always — enjoy the update!

Note di rilascio
Update overview
No functional modifications.
Minor changes : graph correction plus "tooltip" added in the section hours input.
Note di rilascio
Key New Feature: Divergence Analysis
The indicator now detects regular bullish and bearish divergences between price swings and the Fast Stochastic oscillator on a daily basis.
When a divergence is identified at a swing high or low, it displays a label with "DIV:" followed by the Storz DI value or by the Fast Stochastic value (at daily basis) as option.

Divergence analysis
Bearish Divergence (at swing highs): Price makes a higher high while momentum weakens → potential bearish reversal or correction.
Bullish Divergence (at swing lows): Price makes a lower low while momentum strengthens → potential bullish reversal.

How to interpret
Storz DI > 30 : Very Strong (High-probability reversal zone)
Storz DI > 15 (< 30) : Strong (Clear divergence – good confluence=
Storz DI > 5 (< 15) : Moderate (Weak/moderate divergence – needs confirmation)
Storz DI < 5 : No label (No valid divergence - Momentum and price are aligned)

The Storz DI quantifies how significant the divergence is by measuring the normalized difference between price movement and oscillator movement.

Other Features & Settings
Volume Rate-of-Change filter: Daily swing levels appear bold (high conviction) when volume is expanding, and faded when contracting.
Candle patterns: US (Up Swing), DS (Down Swing), IN (Inside), OUT (Outside).
Close position: P (Positive), mP (Mildly Positve), mN (Mildly Negative), N (Negative) based on where the day closed in the daily range.

Best Timeframes:
From 15min to 240min charts. Daily and weekly levels provide excellent context for intraday price action, bounces, and breakouts.

Open-source, free to use and modify.
Note di rilascio
Release Notes – Latest Update
What’s New in This Version
This update brings significant usability improvements, better visual alignment, and a highly requested new feature.

Main New Feature: Pivot Points Table (Daily + Weekly)
Interactive table displaying classic Pivot Points (PP, R1, R2, S1, S2) for both Daily and Weekly timeframes.
Calculated on the previous completed bar.
Choice of calculation source: hlc3 (classic) or hlco4.
Fully customizable table position (9 available options).
Easy on/off toggle.

Swing High/Low Improvements
Daily Swing High/Low circles are now correctly offset to the beginning of the session (automatic offset based on session length) → much more accurate alignment on intraday charts.
Same improved positioning applied to Weekly Swings.
Internal renaming to last_swing_high / last_swing_low for cleaner code.
Colors fixed to teal/maroon for better readability, while volume-based transparency remains fully active.

Divergence Analysis (Storz DI)
Simplified and more stable Storz Divergence Index calculation.
Proper reset of price range and oscillator variables after each swing.
Fast Stochastic now calculated more consistently (lookahead off + correct shift).
Removed the old fixed thrhdSDI threshold for a cleaner and more direct logic.

Candle Pattern Labels
Renamed for clearer meaning:
IN → CTR (Contraction / Inside bar)
OUT → EXP (Expansion / Outside bar)

Improved label placement (correctly anchored on the previous daily bar).
Light transparency added to colors to reduce visual clutter.

Other Improvements
Complete reorganization of Inputs into more logical groups.
Added open price in security requests (required for hlco4 pivots).
“New Day” background disabled by default (only New Week remains if enabled).
Cleaner and more readable code overall.

All original features remain fully functional:
  • Volume-based conviction coloring
  • Daily/Weekly Swing levels
  • Divergence labels (Stochastic or Storz DI)
  • Close Position labels (P / mP / mN / N)


Best Timeframes: 5min – 240min
Ideal for intraday traders who want key levels (Swings + Pivots) combined with volume context and divergence signals in a single lightweight tool.

Open-source as always.
Happy trading!

Declinazione di responsabilità

Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.