How It Works
The script calculates two Simple Moving Averages (SMA): a fast MA (default length = 9) and a slow MA (default length = 21).
The trend is determined by the relationship between the two MAs:
Uptrend: Fast MA > Slow MA.
Downtrend: Fast MA < Slow MA.
Alerts are triggered when the trend changes:
Uptrend Alert: When the fast MA crosses above the slow MA.
Downtrend Alert: When the fast MA crosses below the slow MA.
The chart background changes color to indicate the trend, and labels are displayed for clarity.