Author: Jiangnan Xiaoyin (江南小隐) Original Language: Chinese (Simplified) Market Focus: A-shares (Shanghai & Shenzhen Stock Exchanges) Trading Style: Divergence-based timing for entries and exits across all timeframes
Jiangnan Xiaoyin's thesis is that divergence between price action and technical indicators is the single most reliable signal for trend exhaustion and reversal. While most traders use indicators as trend-following tools, divergence analysis inverts this — it uses indicators to identify when the current trend is losing internal strength, even as price continues to make new extremes.
Core principles:
| Type | Price Action | Indicator Action | Implication |
|---|---|---|---|
| Regular Bearish | Higher high | Lower high | Trend exhaustion at top |
| Regular Bullish | Lower low | Higher low | Trend exhaustion at bottom |
| Hidden Bearish | Lower high | Higher high | Continuation of downtrend |
| Hidden Bullish | Higher low | Lower low | Continuation of uptrend |
| Class | Description | Reliability |
|---|---|---|
| Class A (Strong) | Clear, large divergence with significant indicator movement | High (70%+) |
| Class B (Moderate) | Visible divergence but with smaller indicator differential | Moderate (55-65%) |
| Class C (Weak) | Marginal divergence, barely visible | Low (40-50%) — avoid |
The MACD (Moving Average Convergence Divergence) is the primary divergence indicator in this methodology.
The histogram divergence is the earliest warning:
Bearish Histogram Divergence:
Price makes higher high at time T2 vs T1
MACD histogram peak at T2 < histogram peak at T1
-> Momentum is declining despite higher prices
Bullish Histogram Divergence:
Price makes lower low at time T2 vs T1
MACD histogram trough at T2 > histogram trough at T1 (less negative)
-> Selling pressure is weakening despite lower prices
More significant than histogram divergence:
Bearish DIF Divergence:
Price higher high + DIF lower high
Especially powerful when DIF fails to cross above zero on the second peak
Bullish DIF Divergence:
Price lower low + DIF higher low
Especially powerful when DIF fails to cross below zero on the second trough
A special form of MACD divergence:
When three consecutive price highs (or lows) show progressively weaker MACD readings:
Price: High1 < High2 < High3 (three higher highs)
MACD: Peak1 > Peak2 > Peak3 (three lower peaks)
-> Triple bearish divergence — extremely strong reversal signal
Triple divergence is rare but has the highest reliability rate (estimated 80%+ reversal probability).
Bearish RSI Divergence:
Price makes higher high
RSI makes lower high
Most powerful when RSI was >= 70 at the first peak but < 70 at the second
Bullish RSI Divergence:
Price makes lower low
RSI makes higher low
Most powerful when RSI was <= 30 at the first trough but > 30 at the second
The power of RSI divergence is amplified by the zone in which it occurs:
| Scenario | Zone | Signal Strength |
|---|---|---|
| Bearish divergence with RSI > 70 | Overbought | Strong sell signal |
| Bearish divergence with RSI 50-70 | Neutral | Moderate — wait for confirmation |
| Bearish divergence with RSI < 50 | Oversold | Weak — likely just a pause in downtrend |
| Bullish divergence with RSI < 30 | Oversold | Strong buy signal |
| Bullish divergence with RSI 30-50 | Neutral | Moderate — wait for confirmation |
| Bullish divergence with RSI > 50 | Overbought | Weak — likely just a pause in uptrend |
An RSI failure swing combined with divergence is a high-probability setup:
Bullish Failure Swing:
Bearish Failure Swing:
| Price | Volume | Interpretation |
|---|---|---|
| Rising | Rising | Healthy trend — no divergence |
| Rising | Falling | Bearish divergence — rally losing participation |
| Falling | Rising | Climax selling or distribution — watch for reversal |
| Falling | Falling | Selling exhaustion — potential bullish divergence |
As price makes successive higher highs:
As price makes successive lower lows:
On-Balance Volume provides a cumulative measure of volume flow:
Bullish OBV Divergence:
Price: lower low
OBV: higher low or flat
-> Volume is flowing into the stock even as price declines
Bearish OBV Divergence:
Price: higher high
OBV: lower high or flat
-> Volume is flowing out despite rising price
A market or stock top is forming when multiple divergence signals converge:
top_score = 0
if MACD_histogram_bearish_divergence: top_score += 2
if MACD_line_bearish_divergence: top_score += 2
if RSI_bearish_divergence: top_score += 2
if RSI_in_overbought_zone: top_score += 1
if volume_price_bearish_divergence: top_score += 2
if OBV_bearish_divergence: top_score += 1
if triple_divergence_any_indicator: top_score += 3
# top_score >= 6: high-probability top
# top_score 4-5: probable top — prepare to reduce
# top_score < 4: warning only — monitor
The larger the timeframe, the more significant the divergence.
Divergence alone is not an exit trigger. Wait for price confirmation:
bottom_score = 0
if MACD_histogram_bullish_divergence: bottom_score += 2
if MACD_line_bullish_divergence: bottom_score += 2
if RSI_bullish_divergence: bottom_score += 2
if RSI_in_oversold_zone: bottom_score += 1
if volume_declining_into_new_lows: bottom_score += 2
if OBV_bullish_divergence: bottom_score += 1
if triple_divergence_any_indicator: bottom_score += 3
# bottom_score >= 6: high-probability bottom
# bottom_score 4-5: probable bottom — prepare to buy
# bottom_score < 4: too early — continue monitoring
Jiangnan Xiaoyin's highest-conviction bottom signal:
This "golden divergence" has the highest expected value of any setup in the book.
Occurs during pullbacks within an uptrend:
Context: Stock is in an uptrend (above rising 20-day MA)
Price: Makes a higher low (pullback within uptrend)
MACD: Makes a lower low (indicator drops further than expected)
Interpretation: Despite the deeper indicator drop, the uptrend is intact
because price held a higher low. Trend will resume.
Entry: Buy when MACD histogram begins to turn positive again.
Occurs during bounces within a downtrend:
Context: Stock is in a downtrend (below declining 20-day MA)
Price: Makes a lower high (bounce within downtrend)
MACD: Makes a higher high (indicator rises further than expected)
Interpretation: Despite the stronger indicator bounce, the downtrend is intact
because price failed to make a higher high. Decline will resume.
Action: Sell or short when MACD histogram turns negative again.
| Market Trend | Regular Divergence | Hidden Divergence | Action |
|---|---|---|---|
| Uptrend | Bearish (at top) | Bullish (at pullback) | Regular = reduce/exit; Hidden = add/enter |
| Downtrend | Bullish (at bottom) | Bearish (at bounce) | Regular = buy; Hidden = sell/avoid |
The sequence: hidden divergence during the trend --> eventual regular divergence at the trend end. This lifecycle allows a complete trading framework:
A single indicator showing divergence has a base reliability of 50-60%. Each additional confirming indicator increases reliability:
| Number of Confirming Indicators | Estimated Reliability |
|---|---|
| 1 indicator | 50-60% |
| 2 indicators | 65-75% |
| 3 indicators | 75-85% |
| 4+ indicators | 85%+ |
def calculate_divergence_score(stock, date, direction):
"""Calculate confluence score for divergence signals."""
score = 0
signals = []
if detect_macd_histogram_divergence(stock, date, direction):
score += 2
signals.append('MACD_HIST')
if detect_macd_line_divergence(stock, date, direction):
score += 2
signals.append('MACD_LINE')
if detect_rsi_divergence(stock, date, direction):
score += 2
signals.append('RSI')
if detect_volume_price_divergence(stock, date, direction):
score += 2
signals.append('VOL_PRICE')
if detect_obv_divergence(stock, date, direction):
score += 1
signals.append('OBV')
# Bonus for triple divergence on any single indicator
if any(detect_triple_divergence(stock, date, direction, ind)
for ind in ['MACD', 'RSI']):
score += 3
signals.append('TRIPLE')
return score, signals
| Timeframe | Signal Duration | Use Case |
|---|---|---|
| 15-minute | Hours | Intraday timing for entry/exit |
| 60-minute | 1-3 days | Short-term swing timing |
| Daily | 1-4 weeks | Primary swing trading signals |
| Weekly | 1-6 months | Intermediate trend signals |
| Monthly | 6-24 months | Major cyclical turning points |
A divergence signal on the weekly chart confirmed by the daily chart is far more powerful than a daily-only signal.
When different timeframes show conflicting divergence:
Step 1: Detect divergence (warning phase)
Step 2: Wait for price confirmation (trigger phase)
Step 3: Enter with defined risk (execution phase)
Do NOT enter on divergence alone.
The divergence tells you the market is ready to turn.
The price confirmation tells you the turn has begun.
After bullish divergence is detected:
If you are already long and detect bearish divergence:
def divergence_trailing_stop(position, stock, date):
"""Adjust trailing stop based on divergence state."""
bearish_div = detect_bearish_divergence(stock, date)
if bearish_div and bearish_div.strength == 'CLASS_A':
# Tighten stop to 5-day MA
position.stop = max(position.stop, stock.ma5(date))
elif bearish_div and bearish_div.strength == 'CLASS_B':
# Tighten stop to 10-day MA
position.stop = max(position.stop, stock.ma10(date))
else:
# Normal trailing at 20-day MA
if position.gain_pct >= 0.10:
position.stop = max(position.stop, stock.ma20(date))
return position.stop
| Divergence Quality | Confluence Score | Position Size |
|---|---|---|
| Golden divergence (5+ indicators) | >= 8 | 25-30% of capital |
| Strong divergence (3-4 indicators) | 5-7 | 15-20% of capital |
| Moderate divergence (2 indicators) | 3-4 | 10-15% of capital |
| Weak divergence (1 indicator) | 1-2 | No trade |
When a divergence signal fails (price continues in the original direction past the divergent extreme):
The most common error: entering on divergence before price confirms the reversal. Divergence can persist for many bars before the reversal actually begins. A stock can show bearish divergence and then rally another 20%.
Bullish divergence in a strong downtrend may produce only a brief bounce, not a trend reversal. Always consider whether the divergence is powerful enough to reverse the prevailing trend, or whether it will only produce a countertrend correction.
Never trade on a single indicator's divergence. Always seek confirmation from at least one additional source (another indicator or volume).
A 15-minute divergence signal cannot reverse a daily downtrend. Match the timeframe of the divergence to the timeframe of your trade.
"Divergence is the market's confession that it is lying. When price says one thing and momentum says another, believe momentum — it is harder to fake."
"Every great top and every great bottom is preceded by divergence. This is not a theory; it is a law of market physics. Momentum must fail before price can reverse."
"A single divergence is a yellow light. Two divergences across different indicators is a red light. Three divergences is a brick wall — the trend will not pass."
"The most dangerous word in a trader's vocabulary is 'early.' Divergence detected is not the same as divergence confirmed. Wait for price to agree before you act."
"Hidden divergence is the silent partner of trend-following. It tells you when the correction is a gift, not a threat. Buy the hidden bullish divergence in an uptrend; sell the hidden bearish divergence in a downtrend."
"Volume is the lie detector of the market. When price makes a new high but volume cannot match, the market is testifying under oath — and it is perjuring itself."
"Triple divergence is the market screaming. If you cannot hear three divergences across three indicators, you are not listening — you are hoping."
"The golden divergence setup — multiple indicators, extreme zones, volume confirmation — appears rarely. When it does, it is the highest-probability trade in all of technical analysis. Be ready for it."
"Never fight the timeframe hierarchy. A daily divergence cannot overpower a weekly trend. A weekly divergence cannot overpower a monthly trend. Trade with the largest timeframe, time with the smallest."
This specification synthesizes the core methodology from "背离技术分析" by Jiangnan Xiaoyin, structured as an actionable implementation guide for divergence-based trading in the A-share market.