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
Korumalı komut dosyası
Bu komut dosyası kapalı kaynak olarak yayınlanmaktadır. Ancak, özgürce ve herhangi bir sınırlama olmaksızın kullanabilirsiniz – daha fazla bilgi burada.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.
Korumalı komut dosyası
Bu komut dosyası kapalı kaynak olarak yayınlanmaktadır. Ancak, özgürce ve herhangi bir sınırlama olmaksızın kullanabilirsiniz – daha fazla bilgi burada.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.