OPEN-SOURCE SCRIPT

BB & SMA Alerts (Universal)

This script will:

Plot Bollinger Bands (BB 20, 2 StdDev)
Plot SMA 50 & SMA 200 for trend analysis
Send alerts when price crosses BB, SMA 50, or SMA 200
Detect Golden Cross (Bullish) & Death Cross (Bearish) signals

Do note that this is not a guarantee as markets are often irrational, hence these indicators are supposed to supplement your decision making process and not to be used as 100% truth.

The assumptions are made as a universal format that can be used for most asset classes in Equities, Futures, Crypto.

Have not tested it on Funds, Bonds.

Appendix:
Best Practice: Use 20-SMA for Bollinger Bands and keep 50/200-SMA for trend confirmation.

SMA
• Short-Term (Fast) → 9 SMA (Great for intraday trades)
• Medium-Term → 50 SMA (Good for swing trading)
• Long-Term (Slow) → 200 SMA (For overall trend direction)

BB
Why Bollinger Bands Use SMA 20?
• Shorter time frame captures price fluctuations.
• More reactive to price changes → good for reversion trades.
• If you increase it to 50 or 200, Bollinger Bands will be too wide → making it hard to trade reversion.
• Bollinger Bands (50-SMA) → Becomes less sensitive to short-term price swings.
• Bollinger Bands (200-SMA) → Almost useless for mean reversion, since price barely touches bands.

Suggested Use Case:
🔹 Use BB (20-SMA) for entry signals.
🔹 Use 50-SMA & 200-SMA to confirm trend direction.
🔹 Example Trading Strategy:
• If price touches lower BB AND is above 200-SMA → Look for a BUY.
• If price touches upper BB AND is below 200-SMA → Look for a SELL.

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.