OPEN-SOURCE SCRIPT

Trend Angle Monitor | Fibonacci & Gann Cycles

1 565

Trend Angle Monitor | Fibonacci & Gann Cycles


Overview

Trend Angle Monitor measures the slope angle of price relative to the Average True Range (ATR) across three independent periods. By normalizing price movement with ATR, the tool produces degree-based angle readings that reflect genuine momentum strength — regardless of the asset's absolute price level or volatility regime. All three periods are derived from Fibonacci and Gann cycle numbers and are automatically adjusted to the active chart timeframe.

How it works

Angle calculation
Each angle is derived from the arctangent of the price change over a given lookback period divided by the ATR of that same period. Positive values indicate upward momentum; negative values indicate downward momentum. The magnitude reflects the steepness of the trend relative to normal volatility — not just raw price distance.

Three independent periods (P1, P2, P3)
Three trend angle lines are plotted simultaneously, each operating on a different lookback period. P1 is the fastest (short-term momentum), P2 is intermediate, and P3 is the slowest (structural trend). Period values are sourced from the Fibonacci sequence and Gann cycle theory:

P1 — Fast: 8, 13, or 21 bars depending on timeframe
P2 — Medium: 13, 21, 34, or 55 bars
P3 — Slow: 21, 55, 89, or 144 bars
Auto timeframe detection
When enabled, the tool detects the current chart timeframe (M1 through 1W) and automatically selects the most appropriate Fibonacci/Gann period set and angle thresholds. A manual preset override is available for users who prefer fixed parameters.

Background gradient
The chart background reflects the combined momentum state of all three angle lines. Each angle scores +1 (above upper threshold), −1 (below lower threshold), or 0 (neutral). The total score ranges from −3 to +3, producing seven distinct states:

+3
Yellow → Green — all three bullish
+2
Yellow → Light Green — two bullish
+1
Yellow → Gold — one bullish dominant
0
Orange — mixed / neutral
−1
Orange → Red — one bearish dominant
−2
Red-Orange — two bearish
−3
Orange → Deep Red — all three bearish
The gradient deepens progressively the longer the regime persists, building intensity over up to 30 bars.

Long / short signals
A green triangle (▲) is plotted below the bar when all three angles simultaneously cross above their upper thresholds for the first time (score transitions to +3). A red triangle (▼) is plotted above the bar when all three angles simultaneously cross below their lower thresholds (score transitions to −3).

Signals are non-repeating: once a long signal fires, it will not fire again until a confirmed short signal (−3) has occurred first, and vice versa. This prevents signal spam during choppy conditions while preserving clean re-entry logic after a genuine trend reversal.

Bar coloring
Individual bars are colored based on the P1 (fastest) angle state — bullish color above the upper threshold, neutral color within the neutral zone, bearish color below the lower threshold.

Trend lines and labels
Each of the three periods draws a straight price line from the lookback bar to the current bar, color-coded by its momentum state. Optional floating labels display the current angle value in degrees at the origin of each line, positioned above or below price depending on whether the angle is rising or falling.

Info panel
A compact table in the bottom-right corner shows the current and previous bar angle values for all three periods, color-coded by regime. It also displays the active timeframe preset, the threshold in use, and an overall BIAS reading (BULLISH / NEUTRAL / BEARISH) based on whether all three angles are in agreement.

Settings
Preset settings
Auto timeframe detection — enables automatic period and threshold selection
Manual preset — choose from M1, M5, M15, M30, 1H, 4H, 1D, 1W
Show info panel — toggle the summary table
Background gradient — toggle the background color system
Per-line settings (repeated for P1, P2, P3)
Show line, price source, period (manual), use auto period
Show label, line thickness
Line color, bullish color, bearish color, neutral color
Upper / lower threshold (manual), use auto threshold

Notes
Plots directly on the price chart as an overlay.
No external data sources are used. All calculations are self-contained.
Signals are bar-confirmed and do not repaint.
Designed for use on any liquid instrument across all major timeframes.

This tool is for informational and educational purposes only. It does not constitute financial advice, a trading recommendation, or a signal to buy or sell any asset. Past performance of any pattern or signal does not guarantee future results.
Always confirm setups across multiple timeframes and combine this tool with other forms of analysis before making any trading decision. Never risk more than you can afford to lose, and always apply proper position sizing and risk management. You are solely responsible for your own trading decisions.

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.