What is Supply & Demand?
Supply and Demand is a core economic principle that drives price movement in all markets. In trading, these zones represent areas where institutional traders (banks, hedge funds) have placed significant orders.
When price returns to these zones, there's often a strong reaction as unfilled orders get executed. This creates high-probability trading opportunities.
Supply Zone (Resistance)
- • Area where sellers overwhelm buyers
- • Price dropped sharply from this level
- • Unfilled sell orders may still exist
- • Look for short opportunities here
Demand Zone (Support)
- • Area where buyers overwhelm sellers
- • Price rallied sharply from this level
- • Unfilled buy orders may still exist
- • Look for long opportunities here
Key Insight
How to Identify Valid Zones
Not all price levels are valid supply/demand zones. Look for these characteristics:
Strong Departure
Price must leave the zone with momentum (large candles, minimal consolidation). A weak departure = weak zone.
Fresh Zone
The zone has not been tested yet. Once price returns and reacts, the zone is 'used up'.
Extended Move
Price should travel a significant distance from the zone. This shows conviction behind the move.
Time at Zone
Less time spent at the zone = stronger. Quick reversals indicate institutional urgency.
Pro Tip
Zone Formation Patterns
Zones typically form in one of these three patterns:
Drop-Base-Drop
Supply zone pattern. Price drops, consolidates briefly (base), then drops again.
Rally-Base-Rally
Demand zone pattern. Price rallies, consolidates briefly (base), then rallies again.
Drop-Base-Rally
Demand zone at reversal. Price drops into zone, consolidates, then reverses up.
Rally-Base-Drop
Supply zone at reversal. Price rallies into zone, consolidates, then reverses down.
The base is the consolidation area that forms your zone. Draw your zone from the top to bottom of the base.
Detecting Zones with Python
Let's write Python code to automatically detect potential supply and demand zones based on strong price departures.
# Install: pip install yfinance pandas numpy
import yfinance as yf
import pandas as pd
import numpy as np
def find_supply_demand_zones(ticker: str, period: str = "6mo") -> dict:
"""
Identify potential supply and demand zones based on strong price moves.
A zone is identified when:
1. Price consolidates briefly (2-5 candles)
2. Then makes a strong move (> 2% in single candle)
"""
# Fetch data
df = yf.download(ticker, period=period, interval="1d")
# Calculate percentage change
df['pct_change'] = df['Close'].pct_change() * 100
# Define thresholds
STRONG_MOVE_THRESHOLD = 2.0 # 2% move
zones = {'supply': [], 'demand': []}
for i in range(5, len(df) - 1):
current_move = df['pct_change'].iloc[i]
# Check for strong bearish move (potential supply zone above)
if current_move < -STRONG_MOVE_THRESHOLD:
# The consolidation before the drop is the supply zone
zone_high = df['High'].iloc[i-3:i].max()
zone_low = df['Low'].iloc[i-3:i].min()
zones['supply'].append({
'date': df.index[i],
'zone_high': round(zone_high, 2),
'zone_low': round(zone_low, 2),
'strength': abs(current_move)
})
# Check for strong bullish move (potential demand zone below)
elif current_move > STRONG_MOVE_THRESHOLD:
# The consolidation before the rally is the demand zone
zone_high = df['High'].iloc[i-3:i].max()
zone_low = df['Low'].iloc[i-3:i].min()
zones['demand'].append({
'date': df.index[i],
'zone_high': round(zone_high, 2),
'zone_low': round(zone_low, 2),
'strength': current_move
})
return zones, df
# Example usage
ticker = "RELIANCE.NS"
zones, price_data = find_supply_demand_zones(ticker)
print(f"\n📊 Supply & Demand Zones for {ticker}")
print("=" * 50)
print(f"\n🔴 SUPPLY ZONES (Potential Resistance):")
for zone in zones['supply'][-5:]: # Last 5 zones
print(f" Zone: ₹{zone['zone_low']} - ₹{zone['zone_high']} | Strength: {zone['strength']:.1f}%")
print(f"\n🟢 DEMAND ZONES (Potential Support):")
for zone in zones['demand'][-5:]: # Last 5 zones
print(f" Zone: ₹{zone['zone_low']} - ₹{zone['zone_high']} | Strength: {zone['strength']:.1f}%")Here's the output you'll see:
📊 Supply & Demand Zones for RELIANCE.NS
==================================================
🔴 SUPPLY ZONES (Potential Resistance):
Zone: ₹2985.50 - ₹3010.25 | Strength: 2.8%
Zone: ₹3045.00 - ₹3062.30 | Strength: 3.1%
Zone: ₹2890.75 - ₹2915.00 | Strength: 2.4%
🟢 DEMAND ZONES (Potential Support):
Zone: ₹2750.00 - ₹2780.50 | Strength: 2.9%
Zone: ₹2825.25 - ₹2855.00 | Strength: 2.2%
Zone: ₹2680.00 - ₹2705.75 | Strength: 3.5%Visualizing Zones on Charts
Let's create a chart that highlights our supply and demand zones:
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import yfinance as yf
def plot_zones_on_chart(ticker: str):
"""
Plot candlestick chart with supply/demand zones highlighted.
"""
zones, df = find_supply_demand_zones(ticker, period="3mo")
# Create figure
fig, ax = plt.subplots(figsize=(14, 8))
fig.patch.set_facecolor('#0a0a0a')
ax.set_facecolor('#0a0a0a')
# Plot price as line chart
ax.plot(df.index, df['Close'], color='white', linewidth=1.5, label='Close Price')
# Plot Supply Zones (Red rectangles)
for zone in zones['supply'][-3:]: # Last 3 zones
ax.axhspan(
zone['zone_low'], zone['zone_high'],
alpha=0.3, color='red',
label='Supply Zone' if zone == zones['supply'][-3] else None
)
ax.axhline(y=zone['zone_high'], color='red', linestyle='--', alpha=0.5)
# Plot Demand Zones (Green rectangles)
for zone in zones['demand'][-3:]: # Last 3 zones
ax.axhspan(
zone['zone_low'], zone['zone_high'],
alpha=0.3, color='lime',
label='Demand Zone' if zone == zones['demand'][-3] else None
)
ax.axhline(y=zone['zone_low'], color='lime', linestyle='--', alpha=0.5)
# Styling
ax.set_title(f'{ticker} - Supply & Demand Zones', color='white', fontsize=14, fontweight='bold')
ax.set_xlabel('Date', color='gray')
ax.set_ylabel('Price (₹)', color='gray')
ax.tick_params(colors='gray')
ax.legend(loc='upper left', facecolor='#1a1a1a', edgecolor='gray', labelcolor='white')
ax.grid(True, alpha=0.2, color='gray')
plt.tight_layout()
plt.savefig('supply_demand_chart.png', facecolor='#0a0a0a', dpi=150)
print("✅ Chart saved as supply_demand_chart.png")
# Generate the chart
plot_zones_on_chart("RELIANCE.NS")Enhanced Analysis
- • The zones are colored as semi-transparent rectangles
- • Red zones = Supply (look for shorts)
- • Green zones = Demand (look for longs)
- • Dashed lines mark the zone boundaries
Trading Supply & Demand Zones
Here's a systematic approach to trading these zones:
Identify the Zone
Mark fresh zones on higher timeframes (Daily, 4H). These have more significance.
Wait for Price to Return
Don't chase price. Wait for it to come back to your zone.
Look for Confirmation
Wait for a reversal candlestick pattern (pin bar, engulfing) at the zone.
Enter with Tight Stop
Enter on confirmation. Place stop loss just beyond the zone.
Target the Opposite Zone
Aim for the next supply zone (if long) or demand zone (if short).
Risk Management
- • Risk 1-2% per trade maximum
- • Aim for 1:2 or 1:3 risk-reward ratio
- • If the zone breaks with volume, it's invalidated
- • Fresh zones are stronger than tested zones
Key Takeaways
- Supply zones = areas where sellers overwhelmed buyers (look for shorts)
- Demand zones = areas where buyers overwhelmed sellers (look for longs)
- Valid zones have: strong departure, fresh (untested), extended move
- Zone patterns: Drop-Base-Drop, Rally-Base-Rally, Rally-Base-Drop
- Wait for price to return to zones and show confirmation before entering
- Use Python to automatically detect zones based on strong price moves