OPEN-SOURCE SCRIPT
umbul98-Doji RSI with Divergence

🔹 1. Basic Logic
This indicator combines two things:
🕯 Doji candlestick pattern → Indecision/reversal signal
📈 RSI (Relative Strength Index) → Overbought/oversold condition
👉 So instead of a Doji alone:
It produces a more filtered signal with “Doji + RSI position”.
🔹 2. How is a Doji Detected?
The indicator defines a classic Doji as follows:
The candle body is very small.
The upper and lower wicks are close together (balance exists).
In the code:
Body = less than 5% of the total range.
Wicks are approximately equal.
👉 This allows:
True indecision candles are filtered out (junk Dojis are eliminated).
🔹 3. RSI Integration (The most critical part)
It divides Dojis into 3 categories according to RSI:
🟢 1. Lower Boundary Doji (RSI ≤ 30)
Oversold zone
Doji = selling pressure may be weakening
👉 Interpretation: Possibility of an uptrend
🔴 2. Upper Boundary Doji (RSI ≥ 70)
Overbought zone
Doji = buying pressure may be weakening
👉 Interpretation: Possibility of a downtrend
⚪ 3. Neutral Doji (30 < (RSI < 70)
Uncertain market
👉 Comment: Wait / direction unclear
🔹 What does the 4th chart show?
✔️ "D" label on the candle
Marks the bar where a Doji is forming
Meaning changes according to color:
🟢 Green → Possible upward reversal
🔴 Red → Possible downward reversal
⚪ Gray → Undecided
✔️ Background Colors
Green → RSI low + Doji
Red → RSI high + Doji
Gray → Neutral
👉 This is a very good visual filter 👍
✔️ Tooltip (explanation when hovered over)
Each label has a comment:
“May show an upward trend”
“May show a downward trend”
✔️ Alarm System
There are 3 different alarms:
RSI ≤ 30 + Doji
RSI ≥ 70 + Doji
Neutral Doji
👉 Can be linked to TradingView alarm
🔹 5. Purpose of Use
This indicator is especially useful for: Ideal:
✅ Bottom capture (reversal)
RSI below 30 + Doji → strong signal
✅ Top capture
RSI above 70 + Doji → selling opportunity
✅ Fake signal filtering
Confirmation with RSI instead of Doji alone
🔹 6. Strengths
✔ Noise-reduced Doji detection
✔ Smart filtering with RSI
✔ Visually very clear (label + background)
✔ Alarm supported
✔ Simple but effective strategy infrastructure
🔹 7. Weaknesses (Important ⚠️)
❗ If used alone:
Can mislead in trend market
Constantly generates Doji (especially low timeframe)
👉 Therefore, best use:
With EMA trend filter
With support/resistance
Consolidation breakout island
This indicator combines two things:
🕯 Doji candlestick pattern → Indecision/reversal signal
📈 RSI (Relative Strength Index) → Overbought/oversold condition
👉 So instead of a Doji alone:
It produces a more filtered signal with “Doji + RSI position”.
🔹 2. How is a Doji Detected?
The indicator defines a classic Doji as follows:
The candle body is very small.
The upper and lower wicks are close together (balance exists).
In the code:
Body = less than 5% of the total range.
Wicks are approximately equal.
👉 This allows:
True indecision candles are filtered out (junk Dojis are eliminated).
🔹 3. RSI Integration (The most critical part)
It divides Dojis into 3 categories according to RSI:
🟢 1. Lower Boundary Doji (RSI ≤ 30)
Oversold zone
Doji = selling pressure may be weakening
👉 Interpretation: Possibility of an uptrend
🔴 2. Upper Boundary Doji (RSI ≥ 70)
Overbought zone
Doji = buying pressure may be weakening
👉 Interpretation: Possibility of a downtrend
⚪ 3. Neutral Doji (30 < (RSI < 70)
Uncertain market
👉 Comment: Wait / direction unclear
🔹 What does the 4th chart show?
✔️ "D" label on the candle
Marks the bar where a Doji is forming
Meaning changes according to color:
🟢 Green → Possible upward reversal
🔴 Red → Possible downward reversal
⚪ Gray → Undecided
✔️ Background Colors
Green → RSI low + Doji
Red → RSI high + Doji
Gray → Neutral
👉 This is a very good visual filter 👍
✔️ Tooltip (explanation when hovered over)
Each label has a comment:
“May show an upward trend”
“May show a downward trend”
✔️ Alarm System
There are 3 different alarms:
RSI ≤ 30 + Doji
RSI ≥ 70 + Doji
Neutral Doji
👉 Can be linked to TradingView alarm
🔹 5. Purpose of Use
This indicator is especially useful for: Ideal:
✅ Bottom capture (reversal)
RSI below 30 + Doji → strong signal
✅ Top capture
RSI above 70 + Doji → selling opportunity
✅ Fake signal filtering
Confirmation with RSI instead of Doji alone
🔹 6. Strengths
✔ Noise-reduced Doji detection
✔ Smart filtering with RSI
✔ Visually very clear (label + background)
✔ Alarm supported
✔ Simple but effective strategy infrastructure
🔹 7. Weaknesses (Important ⚠️)
❗ If used alone:
Can mislead in trend market
Constantly generates Doji (especially low timeframe)
👉 Therefore, best use:
With EMA trend filter
With support/resistance
Consolidation breakout island
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.