OPEN-SOURCE SCRIPT

Trend+Volume Divergence + Order Block Detector

279

The best in TF 5M

The script combines an order block detector (inspired by LuxAlgo) with a trend and volume divergence entry system.
The first part identifies both bullish and bearish order blocks based on volume pivots. These are typically zones where price has shown a high probability of reversal or strong reaction.
The order block algorithm uses recent volume pivots to detect likely institutional trading zones, marking them with colored boxes (green for bullish, red for bearish).
Bullish order blocks form when the price shows a volume-based pivot to the downside, suggesting possible accumulation at support.
Bearish order blocks appear at volume pivots to the upside, indicating likely distribution or resistance.
The script removes (“mitigates”) these order blocks when price action confirms that the zone is no longer respected.
Average (midpoint) order block levels are drawn as dashed or dotted lines based on your settings for visualization.
Whenever a new order block forms or is mitigated, alert conditions can be triggered.
The trend entry system computes and plots an Exponential Moving Average (EMA, default length 21) on the chart for basic trend detection.
A trend shift is detected when price crosses the EMA (from below is bullish, from above is bearish).
Additional confirmation for trade entries is provided by simple volume divergence logic:
Bullish if price is down but current volume exceeds prior volume.
Bearish if price is up but current volume is lower than the previous bar.
Large BUY (aqua up-triangle) and SELL (fuchsia down-triangle) arrows mark optimal entry points where both trend change and volume divergence are detected together.
Smaller triangles (‘Buy?’ or ‘Sell?’) are plotted where only a trend crossover is detected without supporting volume divergence.
The background color of the chart changes according to trend direction: green when price is above the EMA, red when below.
All major signals (order blocks and entry conditions) can generate alerts for automated or manual trade notifications.
The script is fully configurable via input parameters for block length, visualization style, EMA length, and mitigation settings.
The logic is suitable for scalping and short-term trading, especially on assets like gold (XAUUSD), but can be applied to any instrument or timeframe.
The script relies solely on built-in Pine functions and does not require external libraries or premium data.
The marked order blocks visually help traders identify zones with high probability of rejection or breakout.
By combining institutional-level order flows (via order block logic) with individual supply-demand signals (trend and volume divergence), the script aims to give robust entry ideas with clear visual cues on the chart.

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.