Trend+Volume Divergence + Order Block Detector + Pullback

---
**Script: Trend+Volume Divergence + Order Block Detector + Pullback**
1. **Order Block Detection**:
The script identifies bullish and bearish order blocks based on volume pivots. When certain volume and price action criteria are met (pivots), areas are marked as potential order blocks.
2. **Visual Marking**:
Bullish and bearish order blocks are visually marked using colored boxes and lines (green for bullish, red for bearish).
3. **Order Block Mitigation**:
The script checks if order blocks are still valid or have been “mitigated” by subsequent price action, removing invalidated blocks from the display.
4. **EMA Calculation (Trend Filter)**:
The script plots a 21-period Exponential Moving Average (EMA) which acts as the primary trend filter for trade signals.
5. **Trend Change Detection**:
Buy and sell trend signals are detected based on price crossing the EMA (crossover = potential uptrend, crossunder = potential downtrend), along with price closing in the direction of the move.
6. **Volume Divergence Detection**:
The system checks for volume divergence, e.g., for a buy signal, the current close is lower than the previous close but the current volume is higher, suggesting possible accumulation. The opposite logic is applied to sell signals.
7. **Combined Trade Signals**:
A trade signal (Buy/Sell) is generated only when both the EMA crossover and volume divergence conditions are met simultaneously.
8. **Pullback Logic (Retest Entry)**:
The script introduces a pullback mechanism:
- After an initial Buy/Sell signal, it waits for a brief price retracement to the EMA.
- Only when price retests and closes back above (Buy) or below (Sell) the EMA after a pullback is an additional pullback entry signal plotted.
9. **Trade Signal Visualization**:
- Regular entry signals are plotted as large colored triangles (Aqua for Buy, Fuchsia for Sell).
- Pullback entries are shown as large Blue (Buy) or Red (Sell) triangles with the label “PB”.
10. **Order Block & Trend Only Signals**:
Additional smaller signals are displayed for trend-only situations (without volume confirmation), colored lime (Buy) and red (Sell).
11. **Background Coloring**:
The background color of the chart changes based on the relationship of the price to the EMA (green for bullish, red for bearish).
12. **Alerts**:
The script sets up alerts for both trend+volume divergence signals and pullback signals. These can be used for notifications or automation.
13. **Parameters and Customization**:
The length and styles for order blocks, mitigation method, and EMA period can be configured by the user.
14. **Multiple Order Blocks**:
The script is capable of displaying multiple bullish and bearish order blocks and tracks their status for validity.
15. **Intrabar Logic**:
The script uses real-time bar indexing to manage the pullback and retest logic.
16. **Structure and Modularity**:
The script logic is modular, separating order block management, trend/volume logic, and pullback logic for clarity.
17. **Scalping Adaptation**:
The system is suitable for active scalping, as pullbacks allow for lower-risk entries following market structure shifts.
18. **Dynamic Visuals**:
All trend, order block, and pullback signals update dynamically as new data appears on the chart.
19. **Mitigation Alerts**:
The script also generates alerts for the mitigation (invalidation) of detected bullish or bearish order blocks.
20. **User Friendly and Automated**:
Designed for ease of use with options for automation (alerts) and clear, actionable signals on both the price chart and in the alert system.
---
If you need this text more technical, or more “for beginners,” let me know!
Script su invito
Solo gli utenti approvati dall'autore possono accedere a questo script. È necessario richiedere e ottenere l'autorizzazione per utilizzarlo. Tale autorizzazione viene solitamente concessa dopo il pagamento. Per ulteriori dettagli, seguire le istruzioni dell'autore riportate di seguito o contattare direttamente GoldSmartTrader.
TradingView NON consiglia di pagare o utilizzare uno script a meno che non ci si fidi pienamente del suo autore e non si comprenda il suo funzionamento. Puoi anche trovare alternative gratuite e open-source nei nostri script della comunità.
Istruzioni dell'autore
Attenzione: prima di richiedere l'accesso, leggi la nostra guida per gli script su invito.
Declinazione di responsabilità
Script su invito
Solo gli utenti approvati dall'autore possono accedere a questo script. È necessario richiedere e ottenere l'autorizzazione per utilizzarlo. Tale autorizzazione viene solitamente concessa dopo il pagamento. Per ulteriori dettagli, seguire le istruzioni dell'autore riportate di seguito o contattare direttamente GoldSmartTrader.
TradingView NON consiglia di pagare o utilizzare uno script a meno che non ci si fidi pienamente del suo autore e non si comprenda il suo funzionamento. Puoi anche trovare alternative gratuite e open-source nei nostri script della comunità.
Istruzioni dell'autore
Attenzione: prima di richiedere l'accesso, leggi la nostra guida per gli script su invito.