OPEN-SOURCE SCRIPT

SWING ATR Based V2 - Weekly + Daily

5 658
What does this indicator do?

This is a dual-timeframe extension of the original SGE script. It runs the same structural logic on Weekly (macro filter) and Daily (tactical trigger) simultaneously, with a new Price Discovery detection layer.

1. It identifies Market Swings on two timeframes
The script monitors price action on both the Weekly and the Daily charts at the same time. Each timeframe has its own ATR-based volatility filter, its own range threshold (kRange), and its own confirmation logic requiring at least two significant candles to validate a directional change. The Weekly is fetched via request.security; the Daily runs natively on the chart's bars.

2. It plots Support and Resistance zones for each timeframe
Weekly levels: solid lines, brighter colors (green/red by default).
Daily levels: dashed lines, accent colors (blue/orange by default), tagged with ▲D / ▼D markers.
Auto-cleaning: once a level is broken by a close, the line turns gray and stops extending. Only unbroken levels remain active.

3. It calculates two SGE Scores with a new Price Discovery layer
Each timeframe has its own score (-2 / 0 / +2), with the same one-candle delay as before. The new logic:

Breaking a support/resistance with other levels still standing → score goes to ±2 directly, or to 0 if the previous score was the opposite extreme (smooth transition).
Breaking the last support or the last resistance → Price Discovery mode: the score jumps directly to ±2 regardless of previous state, signaling that the structure has run out of opposing levels.

4. It simplifies visual reading
Each timeframe shows only its N closest unbroken levels (configurable per TF).
The chart candles are colored by the Weekly score (Weekly is treated as the dominant macro filter). If Weekly is disabled, the candles stay neutral.

5. Dashboard (top-right)
A side-by-side panel showing both timeframes:

Current SGE Score (-2 / 0 / +2)
Price Discovery state (UP / DOWN / Non)
Number of active supports
Number of active resistances
Number of levels currently displayed

Summary: A dual-timeframe structural detector. Weekly defines the dominant context; Daily provides faster signals within that context. The Price Discovery flag highlights moments when the market has broken all opposing structure — typically the highest-conviction zones for trend continuation.
Recommended Settings:

kRange: 1.3 / 1.4 (both TFs)
ATR Mult: 0.3 to 0.5
Trade ideas: take Daily entries only when Weekly score agrees (or is in Price Discovery in the same direction).

Script created with Claude AI.

כתב ויתור

המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.