OPEN-SOURCE SCRIPT
Atualizado

Zig Zag Trend Metrics

6 420
Zig Zag Trend Metrics” is a highly versatile indicator, built on the classic Zig Zag concept and thoughtfully designed for technical traders seeking a deeper, more structured view of market dynamics. This tool identifies significant swing highs and lows, classifies them, and annotates each with key metrics, offering a precise snapshot of each movement. It enhances visual analysis by drawing connecting lines that outline the flow of market structure, making trend progression and reversals instantly recognizable. Beyond visual mapping, it features a compact, real-time statistics table that calculates the average price and time deltas for both bullish and bearish swings, giving traders deep insights into trend momentum and rhythm. With extensive customization options, this indicator adapts seamlessly to vast trading styles or chart setups, empowering traders to spot patterns, evaluate trend strength, and make more confident, data-backed decisions.

FEATURES

Automatic Swing Detection
At its core, this indicator automatically identifies swing highs and lows based on a customizable lookback period (default: 10 bars).

Labeling Swing Points
Each swing is visualized with a label that includes:
  • Swing Classification: “HH” (Higher High), “LH” (Lower High), “LL” (Lower Low), or “HL” (Higher Low).
  • Price Difference: Displayed in percentage or absolute value from the previous opposite swing.
  • Time Difference: The number of bars since the previous swing of the opposite type.

These labels offer traders clear, immediate insight into price movements and structural changes.

Visual Lines
The indicator draws three types of lines:
  • Bullish Lines: Connect recent swing lows to new swing highs, indicating uptrends.
  • Bearish Lines: Connect recent swing highs to new swing lows, indicating downtrends.
  • Range Lines: Connect consecutive highs or lows to outline price channels.

Each line type can be color-coded and customized for visibility.

Statistics Table
An on-screen metrics table provides a live summary of trends. Script uses Relative Averaging to smooth price and time changes. This prevents outliers from distorting the data and provides a more reliable sense of typical swing behavior.
  • Uptrend Metrics: Shows average price and time differences from recent bullish swings.
  • Downtrend Metrics: Shows the same for bearish swings.


🛠️ Customization Options
Ability to tailor the indicator to suit their strategy and aesthetic preferences:
  • Swing Period: Adjust sensitivity to short- or long-term swings.
  • Color Settings: Customize line and label colors.
  • Label Display: Choose between absolute or percentage price differences.
  • Table Settings: Modify size, location, or visibility.

This makes the indicator highly flexible and useful across various timeframes and assets.
Notas de Lançamento
Added ability to choose desired color of Range Lines (Channel) in input settings.
Notas de Lançamento
  • Labels: Ability to track cycle info (time differences between same-type pivots) in the labels.
  • Stats: The chosen format of price change is now applied to the table.

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.