Directional SMA Trend LineShort description
A directional trend line based on the fast SMA. The line changes color when the trend regime shifts, using the relationship between a short SMA and a long SMA. Simple, visual, and effective for trend-following and swing trading.
Full description
The Directional SMA Trend Line is a clean trend-following indicator built around two simple moving averages.
The indicator plots the fast SMA as the main trend line. Its color changes depending on the relationship between the fast SMA and the slow SMA:
Green when the fast SMA is above the slow SMA
Purple when the fast SMA is below the slow SMA
This creates a clear directional line that helps traders stay aligned with the prevailing trend. When the color changes, it signals a potential shift in trend direction or market regime.
Suggested settings
On the weekly timeframe , a 10-period fast SMA and a 20-period slow SMA work very well for swing trading. This combination offers a strong balance between responsiveness and trend stability. In many cases, the 10/20 weekly setup is a reliable way to follow medium-term directional moves.
On the daily timeframe , shorter combinations such as 4/7 can also be effective. However, there is no universal setting that works best for every stock. Each stock has its own rhythm and volatility profile, so traders are encouraged to test different fast/slow ratios to find what fits best.
Over time, you may notice that certain categories of stocks tend to respond well to similar SMA relationships. Even so, the weekly 10/20 setup remains a strong baseline for identifying swing trends.
Core idea
The trend is your friend. This indicator is designed to keep the trend visually simple: follow the line, watch the color, and stay on the right side of momentum.
How to use it
Use the line color to quickly identify bullish or bearish trend conditions
Stay cautious when the color changes, as it may indicate a new trend phase
Apply weekly 10/20 settings for swing trading
Test shorter settings on daily charts for stock-specific optimization
Notes
This is a trend-following tool, not a prediction tool. Like all moving-average-based indicators, it may react later in fast reversals or sideways markets.
Pine Script®指標






















