Granville's 8 Rules Visualizer

I’ve created a Pine Script indicator that visually implements **Granville’s Eight Rules**, one of the foundational theories for price movement relative to a moving average (MA). This tool helps traders better time entries and exits based on momentum shifts and MA behavior.
---
### 📈 What is Granville’s Law?
Joseph Granville’s theory suggests that **price and moving average (typically SMA)** interactions produce **8 recurring signals**:
* **4 Buy signals** (B1–B4)
* **4 Sell signals** (S1–S4)
These rules help identify the beginning or continuation of bullish and bearish trends.
---
### 🔍 Indicator Logic
This indicator uses a simple 20-period SMA (modifiable) and tracks price action in relation to it. Each signal is drawn as a triangle with a label (`B1` to `B4` or `S1` to `S4`), based on the following rules:
#### ✅ Buy Signals:
* **B1**: Price crosses above a rising MA (classic breakout)
* **B2**: Price pulls back below a rising MA, then begins rising again
* **B3**: Price bounces off a falling MA
* **B4**: Price is above a rising MA but temporarily drops
#### ❌ Sell Signals:
* **S1**: Price crosses below a falling MA
* **S2**: Price pulls back above a falling MA, then starts dropping again
* **S3**: Price bounces down off a rising MA
* **S4**: Price is below a falling MA but temporarily rises
---
### 🛠 How to Use It:
1. **Trend Confirmation**: Use the moving average slope (rising or falling) as your trend filter.
2. **Entry Timing**: Look for Buy signals (B1–B4) in uptrends and Sell signals (S1–S4) in downtrends.
3. **Avoid Noise**: Combine with volume or volatility filters (e.g. ATR or squeeze) to eliminate weak setups.
4. **Customize**: Adjust the MA type or length to fit your market (e.g. EMA for crypto, SMA for FX).
---
### 💡 Example Strategies:
* Pair **B1 + rising volume** for early trend entries
* Use **B2/B4** for retracement-based entries
* Exit on **S3/S4** for profit taking or stop logic
Happy trading!
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Per un accesso rapido a un grafico, aggiungi questo script ai tuoi preferiti: per saperne di più clicca qui.
Declinazione di responsabilità
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Per un accesso rapido a un grafico, aggiungi questo script ai tuoi preferiti: per saperne di più clicca qui.