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.
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。