OPEN-SOURCE SCRIPT

5-Minute Trend Identifier with Alerts

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.
Moving Averages

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


Also on:

Disclaimer