PROTECTED SOURCE SCRIPT

Linearity Index

46
The Linearity Index (LI) indicator helps traders identify trending and choppy markets by measuring price movement efficiency. It calculates LI using a user-defined lookback period (default: 61 days), dividing the net price change by the sum of absolute daily changes. LI ranges from -1 to 1:

Positive LI: Upward trend
Negative LI: Downward trend
Near 0: Choppy or flat market

Key FeaturesTable Display:


Summarizes data over three periods (1st Year, 2nd Year and 3rd Year)
Linear Days: LI > 0.2 (strong linearity)
Trend Days: Close > 50 SMA and LI > 0.05 (upward trend)
Linearity Index Ratio (LIR): Linear Days / Trend Days,
color-coded:Red (< 0.25)
Yellow (0.25–0.50)
Green (> 0.50)
Total LIR : average of every year's LIR and color coded based on overall LI color

View modes: Full (detailed), Compact (abbreviated), Mini (Yr & LIR only)

Visuals:Horizontal lines at 0.20 ("Linearity Level") and 0.05 ("Choppiness Level")
Background color: Green (LI > 0.2), Red (LI < 0.05)
LI plotted as a dark gray histogram

Customization:Adjustable lookback period
Selectable table view mode (Full, Compact, Mini)

Purpose : The LI indicator provides a quick way to assess market trends and linearity over time, with visual cues and a customizable table for deeper analysis. Ideal for traders seeking to gauge trend strength and market efficiency.

Took inspiration from OmkarBanne 's Trend vs Chop Detector

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。