PROTECTED SOURCE SCRIPT
Linearity Index

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
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
Script protetto
Questo script è pubblicato come codice protetto. Tuttavia, è possibile utilizzarlo liberamente e senza alcuna limitazione – per saperne di più clicca qui.
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.
Script protetto
Questo script è pubblicato come codice protetto. Tuttavia, è possibile utilizzarlo liberamente e senza alcuna limitazione – per saperne di più clicca qui.
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.