OPEN-SOURCE SCRIPT

Objective Doji Highlight (Range-Relative)

34
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.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.