Skip to main content

Overview

The Advanced Indicators API retrieves comprehensive technical analysis data including pivot points, exponential moving averages (EMA), simple moving averages (SMA), and technical indicator sentiment. This endpoint requires the Security ID (Sid) from the master ISIN map. Source File: fetch_advanced_indicators.py

Endpoint Details

URL
string
required
https://ow-static-scanx.dhan.co/staticscanx/indicator
Method
string
required
POST
Content-Type
string
required
application/json

Request Headers

{
  "Content-Type": "application/json",
  "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
  "Accept": "application/json, text/plain, */*"
}

Request Payload

exchange
string
required
Exchange code (typically “NSE”)
segment
string
required
Market segment (“E” for equities)
security_id
string
required
Security ID (Sid) from master_isin_map.json
isin
string
required
ISIN code of the security
symbol
string
required
Trading symbol
minute
string
required
Timeframe - “D” for daily, “W” for weekly, “M” for monthly

Example Payload

{
  "exchange": "NSE",
  "segment": "E",
  "security_id": "11536",
  "isin": "INE002A01018",
  "symbol": "RELIANCE",
  "minute": "D"
}

Example Request

curl -X POST https://ow-static-scanx.dhan.co/staticscanx/indicator \
  -H "Content-Type: application/json" \
  -H "User-Agent: Mozilla/5.0" \
  -d '{
    "exchange": "NSE",
    "segment": "E",
    "security_id": "11536",
    "isin": "INE002A01018",
    "symbol": "RELIANCE",
    "minute": "D"
  }'

Response Structure

data
array
Array containing single indicator object (always length 1)

Indicator Object Fields

EMA
array
Exponential Moving Average data points
SMA
array
Simple Moving Average data points
Indicator
array
Technical indicators including RSI, MACD, Stochastic, etc.
Pivot
array
Pivot point levels (support/resistance)

Example Response

{
  "data": [
    {
      "EMA": [
        {"period": 5, "value": 2598.5, "signal": "Buy"},
        {"period": 9, "value": 2595.2, "signal": "Buy"},
        {"period": 20, "value": 2580.1, "signal": "Buy"},
        {"period": 50, "value": 2550.3, "signal": "Buy"},
        {"period": 100, "value": 2500.5, "signal": "Buy"},
        {"period": 200, "value": 2450.8, "signal": "Buy"}
      ],
      "SMA": [
        {"period": 5, "value": 2600.0, "signal": "Buy"},
        {"period": 9, "value": 2597.5, "signal": "Buy"},
        {"period": 20, "value": 2582.3, "signal": "Buy"},
        {"period": 50, "value": 2552.1, "signal": "Buy"},
        {"period": 100, "value": 2502.6, "signal": "Buy"},
        {"period": 200, "value": 2453.2, "signal": "Buy"}
      ],
      "Indicator": [
        {"name": "RSI(14)", "value": 65.2, "signal": "Buy"},
        {"name": "MACD(12,26)", "value": 15.3, "signal": "Buy"},
        {"name": "Stochastic(14,3,3)", "value": 72.5, "signal": "Buy"},
        {"name": "ADX(14)", "value": 28.4, "signal": "Neutral"}
      ],
      "Pivot": [
        {"level": "R3", "value": 2750.5},
        {"level": "R2", "value": 2700.3},
        {"level": "R1", "value": 2650.2},
        {"level": "Pivot", "value": 2598.5},
        {"level": "S1", "value": 2550.1},
        {"level": "S2", "value": 2500.8},
        {"level": "S3", "value": 2450.6}
      ]
    }
  ]
}

Implementation Details

Configuration

Max Threads
integer
default:"50"
Concurrent threads for parallel processing (highest among all endpoints)
Timeout
integer
default:"10"
Request timeout in seconds
Input File
string
required
master_isin_map.json (must contain Sid field)
Output File
string
advanced_indicator_data.json (~8.3 MB for full market)

Processing Flow

  1. Load Master Map: Read symbols with Sid from master_isin_map.json
  2. Filter Valid Sids: Skip stocks without Sid (required field)
  3. Parallel Fetch: Use ThreadPoolExecutor with 50 workers
  4. Extract Data: Parse EMA, SMA, Indicators, and Pivots
  5. Consolidate: Merge all results into single array
  6. Save: Write to advanced_indicator_data.json

Code Implementation

import requests
import json
from concurrent.futures import ThreadPoolExecutor, as_completed

api_url = "https://ow-static-scanx.dhan.co/staticscanx/indicator"

def fetch_indicators(item):
    symbol = item.get("Symbol")
    isin = item.get("ISIN")
    sid = item.get("Sid")
    
    # Sid is required for this API
    if not sid:
        return None
    
    payload = {
        "exchange": "NSE",
        "segment": "E",
        "security_id": str(sid),
        "isin": isin,
        "symbol": symbol,
        "minute": "D"  # Daily timeframe
    }
    
    try:
        response = requests.post(api_url, json=payload, headers=headers, timeout=10)
        if response.status_code == 200:
            data = response.json().get("data", [])
            if data and isinstance(data, list) and len(data) > 0:
                result = data[0]
                
                return {
                    "Symbol": symbol,
                    "EMA": result.get("EMA", []),
                    "SMA": result.get("SMA", []),
                    "TechnicalIndicators": result.get("Indicator", []),
                    "Pivots": result.get("Pivot", [])
                }
        return None
    except:
        return None

# Load master list
with open("master_isin_map.json", "r") as f:
    master_list = json.load(f)

all_results = []

# Parallel processing
with ThreadPoolExecutor(max_workers=50) as executor:
    future_to_stock = {executor.submit(fetch_indicators, stock): stock 
                       for stock in master_list}
    
    for future in as_completed(future_to_stock):
        res = future.result()
        if res:
            all_results.append(res)

# Save results
with open("advanced_indicator_data.json", "w") as f:
    json.dump(all_results, f, indent=4)

Output Structure

[
  {
    "Symbol": "RELIANCE",
    "EMA": [...],
    "SMA": [...],
    "TechnicalIndicators": [...],
    "Pivots": [...]
  },
  {
    "Symbol": "TCS",
    "EMA": [...],
    "SMA": [...],
    "TechnicalIndicators": [...],
    "Pivots": [...]
  }
]

Technical Indicators Included

Moving Averages

EMA Periods: 5, 9, 20, 50, 100, 200 SMA Periods: 5, 9, 20, 50, 100, 200 Each includes:
  • Period length
  • Current value
  • Signal (Buy/Sell/Neutral)

Technical Indicators

  • RSI (14): Relative Strength Index
  • MACD (12,26): Moving Average Convergence Divergence
  • Stochastic (14,3,3): Stochastic Oscillator
  • ADX (14): Average Directional Index
  • CCI (20): Commodity Channel Index
  • Williams %R (14): Williams Percent Range
  • Bollinger Bands: Upper, Middle, Lower bands

Pivot Points

  • R3, R2, R1: Resistance levels
  • Pivot: Central pivot point
  • S1, S2, S3: Support levels

Signal Interpretation

Buy
string
Price is above the indicator (bullish)
Sell
string
Price is below the indicator (bearish)
Neutral
string
No clear directional bias

Performance Metrics

  • Total Stocks: ~2,775
  • Stocks with Sid: ~2,775 (nearly all)
  • Threads: 50 concurrent requests
  • Time per Stock: ~1-2 seconds
  • Total Time: ~2-3 minutes for full market
  • Output Size: ~8.3 MB
  • Success Rate: >99%

Progress Tracking

Progress: 100/2775 done.
Progress: 200/2775 done.
Progress: 500/2775 done.
...
Successfully saved indicators for 2750 stocks to advanced_indicator_data.json

Timeframe Options

minute
string
  • “D”: Daily (most common)
  • “W”: Weekly
  • “M”: Monthly
  • “1”: 1-minute (intraday)
  • “5”: 5-minute (intraday)
  • “15”: 15-minute (intraday)
  • “60”: 1-hour (intraday)
Note: The implementation defaults to “D” (daily) for end-of-day analysis.

Error Handling

Missing Sid

if not sid:
    return None  # Skip stocks without Sid

API Failure

try:
    response = requests.post(api_url, json=payload, headers=headers, timeout=10)
    if response.status_code == 200:
        data = response.json().get("data", [])
        if data:
            # Process data
            pass
    return None
except:
    return None  # Graceful failure

Use Cases

  1. Technical Screening: Filter stocks by moving average crossovers
  2. Momentum Trading: Identify overbought/oversold via RSI
  3. Support/Resistance: Use pivot points for entry/exit levels
  4. Trend Analysis: Analyze EMA/SMA alignment for trend strength
  5. Signal Aggregation: Combine multiple indicator signals for conviction

Analysis Examples

Find Strong Uptrends

# Price above all major moving averages
strong_uptrends = [
    stock for stock in all_results
    if all(ma.get("signal") == "Buy" for ma in stock.get("SMA", []))
]

RSI Overbought/Oversold

# Find overbought stocks (RSI > 70)
overbought = [
    stock for stock in all_results
    if any(
        ind.get("name") == "RSI(14)" and ind.get("value", 0) > 70
        for ind in stock.get("TechnicalIndicators", [])
    )
]

Golden Cross Candidates

# SMA50 > SMA200 (golden cross)
golden_cross = [
    stock for stock in all_results
    if get_sma_value(stock, 50) > get_sma_value(stock, 200)
]

Notes

  • Sid (Security ID) is mandatory - stocks without Sid are skipped
  • Indicators are calculated based on historical price data
  • Signals are auto-generated based on price vs indicator value
  • Pivot points are calculated using standard formulas (Classic method)
  • Daily timeframe provides most reliable signals for swing trading
  • Intraday timeframes (1m, 5m, 15m) require different endpoint access
  • The API updates indicators at end-of-day after market close

Build docs developers (and LLMs) love