OPEN-SOURCE SCRIPT

Yearly History Calendar-Aligned Price up to 10 Years)

77
Overview

This indicator helps traders compare historical price patterns from the past 10 calendar years with the current price action. It overlays translucent lines (polylines) for each year’s price data on the same calendar dates, providing a visual reference for recurring trends. A dynamic table at the top of the chart summarizes the active years, their price sources, and history retention settings.
Key Features

Historical Projections
Displays price data from the last 10 years (e.g., January 5, 2023 vs. January 5, 2024).

Price Source Selection
Choose from Open, Low, High, Close, or HL2 ((High + Low)/2) for historical alignment.
The selected source is shown in the legend table.

Bulk Control Toggles
Show All Years : Display all 10 years simultaneously.
Keep History for All : Preserve historical lines on year transitions.
Hide History for All : Automatically delete old lines to update with current data.

Individual Year Settings
Toggle visibility for each year (-1 to -10) independently.
Customize color and line width for each year.
Control whether to keep or delete historical lines for specific years.

Visual Alignment Aids
Vertical lines mark yearly transitions for reference.
Polylines are semi-transparent for clarity.

Dynamic Legend Table
Shows active years, their price sources, and history status (On/Off).
Updates automatically when settings change.


How to Use

Configure Settings
Projection Years : Select how many years to display (1–10).
Price Source : Choose Open, Low, High, Close, or HL2 for historical alignment.
History Precision : Set granularity (Daily, 60m, or 15m).
Daily (D) is recommended for long-term analysis (covers 10 years).
60m/15m provides finer precision but may only cover 1–3 years due to data limits.


Adjust Visibility & History
Show Year -X : Enable/disable specific years for comparison.
Keep History for Year -X : Choose whether to retain historical lines or delete them on new year transitions.

Bulk Controls
Show All Years : Display all 10 years at once (overrides individual toggles).
Keep History for All / Hide History for All : Globally enable/disable history retention for all years.

Customize Appearance
Line Width : Adjust polyline thickness for better visibility.
Colors : Assign unique colors to each year for easy identification.

Interpret the Legend Table
The table shows:
Year : Label (e.g., "Year -1").
Source : The selected price type (e.g., "Close", "HL2").
Keep History : Indicates whether lines are preserved (On) or deleted (Off).



Tips for Optimal Use

Use Daily Timeframes for Long-Term Analysis :
Daily (1D) allows 10+ years of data. Smaller timeframes (60m/15m) may have limited historical coverage.

Compare Recurring Patterns :
Look for overlaps between historical polylines and current price to identify potential support/resistance levels.

Customize Colors & Widths :
Use contrasting colors for years you want to highlight. Adjust line widths to avoid clutter.

Leverage Global Toggles :
Enable Show All Years for a quick overview. Use Keep History for All to maintain continuity across transitions.


Example Workflow

Set Up :
Select Projection Years = 5.
Choose Price Source = Close.
Set History Precision = 1D for long-term data.

Customize :
Enable Show Year -1 to Show Year -5.
Assign distinct colors to each year.
Disable Keep History for All to ensure lines update on year transitions.

Analyze :
Observe how the 2023 close prices align with 2024’s price action.
Use vertical lines to identify yearly boundaries.


Common Questions

Why are some years missing?
Ensure the chart has sufficient historical data (e.g., daily charts cover 10 years, 60m/15m may only cover 1–3 years).

How do I update the data?
Adjust the Price Source or toggle years/history settings. The legend table updates automatically.



Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.