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
Skrip dilindungi
Skrip ini diterbitkan sebagai sumber tertutup. Akan tetapi, anda boleh menggunakannya dengan percuma dan tanpa had – ketahui lebih lanjut di sini.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip dilindungi
Skrip ini diterbitkan sebagai sumber tertutup. Akan tetapi, anda boleh menggunakannya dengan percuma dan tanpa had – ketahui lebih lanjut di sini.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.