OPEN-SOURCE SCRIPT

21-Day Trend Direction

299
๐Ÿ“ˆ 21-Day Trend Direction Indicator

๐Ÿ“Š How It Works:
๐ŸŽฏ Trend Detection Logic:
Analyzes last 21 daily candles
Calculates total price change from start to end
Compares against sideways threshold (default 2%)
Counts bullish vs bearish days
Tracks higher highs and lower lows
๐Ÿ“ˆ Trend Classifications:
โ€ข ๐Ÿ“ˆ UPTREND: Price change > +2% over 21 days
โ€ข ๐Ÿ“‰ DOWNTREND: Price change < -2% over 21 days
โ€ข โžก๏ธ SIDEWAYS: Price change between -2% and +2%

๐Ÿ’ช Trend Strength Levels:
โ€ข ๐Ÿ”ฅ Very Strong: >5% price change
โ€ข ๐Ÿ’ช Strong: 3-5% price change
โ€ข ๐Ÿ“Š Moderate: 1.5-3% price change
โ€ข ๐Ÿ“‰ Weak: <1.5% price change

๐ŸŽจ Visual Features:
๐Ÿ“‹ Information Table Shows:
โ€ข Trend Direction with color coding
โ€ข Price Change % over 21 days
โ€ข Trend Strength classification
โ€ข Bull/Bear Days count
โ€ข Higher Highs/Lower Lows count
โ€ข Analysis Period (customizable)

๐Ÿ“Š Chart Indicators:
โ€ข Trend Line (21-day moving average)
โ€ข Background Color for quick trend identification
โ€ข Trend Arrows (โ–ฒ โ–ผ โžก) on chart
โ€ข Customizable display options

โš™๏ธ Customizable Settings:
๐ŸŽฏ Analysis Settings:
โ€ข Lookback Days: 5-50 days (default: 14)
โ€ข Sideways Threshold: 0.5-10% (default: 2%)
โ€ข Trend Strength: Low/Medium/High sensitivity

๐ŸŽจ Display Options:
โ€ข Table Position: 9 different positions
โ€ข Table Size: Tiny to Large
โ€ข Show/Hide: Table, Trend Line, Background, Arrows

๐Ÿšจ Alert Options:
โ€ข Trend Change to Uptrend
โ€ข Trend Change to Downtrend
โ€ข Trend Change to Sideways

This indicator gives you a clear, objective view of the 21-day trend with multiple confirmation signals! ๐Ÿš€

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.