OPEN-SOURCE SCRIPT
Objective Doji Highlight (Range-Relative)

This indicator highlights Doji candles using an objective, mathematics-based rule: a bar is Doji when the absolute difference between its open and close is less than or equal to a user-defined fraction (x) of that bar’s high–low range.
How it works:
Compute body size as the absolute difference between open and close.
Compute the bar’s range as high minus low.
Classify as Doji when body size ≤ x × range.
Only Doji candles are colored; non-Doji bars remain unchanged.
Inputs
Doji threshold (x of range): tolerance (0–1) controlling how small the body must be relative to the range.
Doji Candle Color: visual color for detected Doji candles.
Example:
If x = 0.10 and a candle has high = 100 and low = 90 (range = 10), the maximum allowed body is 1.
If the difference between open and close is ≤ 1, the candle is marked as Doji.
Why it can be useful
Doji candles are often studied as signs of market indecision. This tool provides a clear, parameter-based way to identify them consistently across any timeframe, without discretionary interpretation.
Notes & limitations
Works with standard candlesticks (not Heikin Ashi, Renko, or other synthetic bar types).
Visualization and research only: it does not produce buy/sell signals and makes no performance claims.
No repainting from future data; the logic uses only the current bar’s prices.
How it works:
Compute body size as the absolute difference between open and close.
Compute the bar’s range as high minus low.
Classify as Doji when body size ≤ x × range.
Only Doji candles are colored; non-Doji bars remain unchanged.
Inputs
Doji threshold (x of range): tolerance (0–1) controlling how small the body must be relative to the range.
Doji Candle Color: visual color for detected Doji candles.
Example:
If x = 0.10 and a candle has high = 100 and low = 90 (range = 10), the maximum allowed body is 1.
If the difference between open and close is ≤ 1, the candle is marked as Doji.
Why it can be useful
Doji candles are often studied as signs of market indecision. This tool provides a clear, parameter-based way to identify them consistently across any timeframe, without discretionary interpretation.
Notes & limitations
Works with standard candlesticks (not Heikin Ashi, Renko, or other synthetic bar types).
Visualization and research only: it does not produce buy/sell signals and makes no performance claims.
No repainting from future data; the logic uses only the current bar’s prices.
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.
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.
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.
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.