OPEN-SOURCE SCRIPT

SMA Background + Crossovers (20, 50, 200)

60
This Pine Script plots three Simple Moving Averages (SMA 20, 50, and 200) and visually highlights market conditions using both background colors and crossover signals. The background changes based on where the price is relative to the SMAs — light yellow when below the 20-day, dark yellow when below the 50-day, and red when below the 200-day — providing an instant visual cue of short-, medium-, and long-term weakness.

In addition, the script identifies and marks bullish and bearish crossovers among the SMAs (20/50, 50/200, and 20/200), using upward and downward triangles to signal momentum shifts. Each crossover can also trigger TradingView alerts, allowing the user to automate notifications for trend reversals. Overall, the code combines trend visualization, momentum detection, and alert functionality into one compact indicator.

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.