OPEN-SOURCE SCRIPT
Zaktualizowano

ATH/ATL Fibonacci Retracement - Labels, Golden Pocket & Alerts

549
Plots Fibonacci retracement levels anchored to the all-time high and all-time low of the loaded chart history. The range updates automatically as new highs or lows print, so the levels always reflect the full extent of price action without manual redrawing.

Features:

- Auto ATH/ATL tracking — the 0% and 100% anchors update dynamically across all available history.

- Flip toggle — switch 0% between the top (all-time high) and the bottom (all-time low) to suit your bias or the direction of the move you're measuring.

- Standard Fib levels — 0%, 23.6%, 38.2%, 50%, 61.8%, 78.6%, and 100%, each color-coded.

- On-chart labels — every level shows its retracement percentage alongside the exact price, placed to the right of the last bar. Adjustable offset.

- Golden pocket shading — the 61.8%–78.6% reaction zone is highlighted for quick visual reference. Toggle on/off.

- Built-in alerts — alert conditions on crosses of each major level, plus a golden-pocket entry alert, ready to wire up from the Create Alert dialog.

Notes: Levels are based on the chart's loaded history, so the all-time high/low depends on how far back your data goes and your timeframe. This is an analysis tool, not financial advice — use it alongside your own process and risk management.
Informacje o Wersji
What changed:
The new use_local toggle is your button. When off, the script behaves exactly as before (all-time high/low). When on, it swaps the range anchors to ta.highest(high, lookback) and ta.lowest(low, lookback) — the highest high and lowest low over the last N bars.
I did this by introducing two selector variables, hi and lo, and pointing all the Fib math at them instead of directly at ath/atl. That keeps the flip logic, labels, golden pocket, and alerts untouched — they all just read whatever range is currently active.
The lookback input (default 100 bars) controls how "local" the swing is. Drop it to something like 20–50 for tighter intraday swings, or raise it for broader ones. Note it's a fixed bar-count window, not an automatic swing-point detector — so the local high/low is simply the extreme within that trailing window, which will shift as the window slides.
One thing worth flagging: I removed the "Enter Golden Pocket" compound alert we discussed earlier, since it was the fragile one and you didn't confirm wanting the zone-occupancy version. If you want a reliable pocket-entry alert now that local mode makes the pocket more actionable, I'd add close crossing into math.min/math.max(fib_618, fib_786) — say the word.
Also, since the range is now dynamic in local mode, you might update the published title/description to mention the local/swing option. Want me to revise those?
Informacje o Wersji
WHAT'S NEW

Added: Moving Averages
- Two configurable moving averages (default 150 & 200).
- Independent timeframe control per MA — choose Daily, Weekly, or Monthly for each one separately (e.g. a weekly 150 alongside a monthly 200).
- Full color picker for each MA line.
- Adjustable length for each MA.
- Master show/hide toggle for both MAs at once.
- MAs are pulled from their selected timeframe via higher-timeframe data, so they stay true to that timeframe even when viewed on a lower chart timeframe.

Note: Higher-timeframe MAs require proportionally more history to populate — a monthly 200 SMA needs roughly 17 years of data before it fully renders.

Wyłączenie odpowiedzialności

Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.