/india-trading-skills:market-breadthfrom india-trading-skills
Analyzes market breadth for Indian equities (NSE/BSE) using stock CSVs or yfinance data. Reports % above DMAs, A/D line, McClellan oscillator, breadth thrusts, new highs/lows, and a health score. Useful for assessing whether index moves are broad-based.
Ships in india-trading-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
The index tells you where a few large weights went. Breadth tells you what the typical stock did. A NIFTY high made by five heavyweights while most stocks slide is a weaker market than the chart shows.
python3 scripts/breadth.py status --csv-dir nifty500/ --benchmark-csv "NIFTY 50.csv" --members ind_nifty500list.csv
python3 scripts/breadth.py status --csv-dir nifty500/ --universe-file ind_nifty50list.csv --benchmark-csv nifty.csv
python3 scripts/breadth.py status --ad-csv nse_adv_dec.csv # exchange counts, no stock files
python3 scripts/breadth.py status --universe-file ind_nifty500list.csv --save-dir nifty500/ # yfinance
python3 scripts/breadth.py history --csv-dir nifty500/ --sessions 60 --out breadth.csv --json
Stock CSVs are daily OHLCV, one per stock, file stem = symbol (RELIANCE.csv, .NS is stripped),
from ../technical-analysis/scripts/ta.py fetch, a broker export, or --save-dir (caches the Yahoo
download: ~500 requests for NIFTY 500). Rows with blank or null prices are skipped. --pattern
filters the folder; --universe-file restricts it to a constituent list, so one NIFTY 500 folder
gives NIFTY 50, NIFTY 500 and midcap breadth. --members (symbol,sector, or the Industry column of a
niftyindices list) adds sector participation. Also: --as-of DATE (replay), --hl-window 252,
--div-window 20, --div-min-pct 1.0, --benchmark NAME (yfinance; NIFTY by default when fetching).
ind_nifty500list.csv, with Company Name, Industry and Symbol columns). Pass it straight to
--universe-file or --members.--ad-csv): NSE and BSE show daily advances, declines and unchanged counts,
and 52-week high/low lists, on their market-data pages. nseindia.com blocks scripts, so copy the
numbers by hand or find them with WebSearch in market-wrap reports, citing the source. Columns:
Date,Advances,Declines[,Unchanged,New 52W Highs,New 52W Lows,NIFTY 50]. Any case or spacing
works, and the index column feeds the divergence check. This mode gives A/D, McClellan, thrust and
highs/lows but no DMA participation (that needs per-stock prices).| Metric | Definition in breadth.py |
|---|---|
| % above 20/50/200 DMA | Stocks with close > N-day SMA ÷ stocks with ≥ N bars. Change over 5 and 20 sessions in points |
| Uptrend ratio | % of stocks with close > 50 DMA > 200 DMA (stocks with ≥ 200 bars) |
| Advance / decline | Close vs that stock's previous close; equal = unchanged. A/D line = running sum of A − D (read its slope, not its level) |
| Divergence | Over --div-window sessions: index up ≥ 1% while the A/D line falls = bearish; index down ≥ 1% while it rises = bullish |
| New 52w highs/lows | Today's high above every high of the prior 251 sessions (lows mirrored). Only stocks with 252 bars count |
| McClellan | RANA = 1000 × (A − D)/(A + D). Oscillator = EMA19(RANA) − EMA39(RANA) (smoothing 0.10/0.05, SMA-seeded). Summation = running sum of the oscillator from the first value |
| Breadth thrust | 10-session EMA of A/(A + D) closes above 0.615 having been below 0.40 within the previous 10 sessions (Zweig's thresholds). "Armed" = below 0.40 recently, window still open |
| Sector participation | A sector participates when ≥ 50% of its members are above their 50 DMA |
| Circuit suspects | Zero-range bar (high = low) with a move ≥ 1.9%: probably locked at a price band |
Ratio adjustment lets a 50-stock list and exchange-wide counts share one McClellan scale. The summation level depends on where the data starts, so read its direction and zero crossings.
| Component | Weight | Scaling |
|---|---|---|
| Participation | 25 | 0.2 × %>20 DMA + 0.4 × %>50 DMA + 0.4 × %>200 DMA |
| Uptrend ratio | 15 | 10% → 0, 60% → 100 |
| Participation trend | 10 | 20-session change in %>50 DMA: −25 pts → 0, +25 → 100 |
| A/D line | 15 | 20-session (A − D)/(A + D): −0.25 → 0, +0.25 → 100 |
| McClellan | 10 | oscillator −100 → 0, +100 → 100 |
| Highs vs lows | 15 | 10-session new highs ÷ (highs + lows); none of either = 50 |
| Sectors | 10 | % of sectors participating |
Missing components (no members, short history, --ad-csv) are dropped and the rest re-weighted.
"Coverage" shows how much weight was scored, and under 50% the read is A/D-only. Labels: 75+ Broad
participation, 60–74 Healthy, 40–59 Mixed, 25–39 Narrow / weak, below 25 Very weak. The scalings
are judgement calls, not fitted values, so compare a universe with its own history (history).
history as rough.--ad-csv exchange counts.
Ten stocks give a sketch, not a signal.market-regime sets the exposure ceiling; breadth adjusts within it. Confirmed uptrend with a
score under 40 or a bearish divergence: act one notch lower (fewer, smaller new positions). In a
Correction or Rally attempt, count a thrust as supporting evidence for a follow-through day. Score
60+ with %>50 DMA rising backs the uptrend.market-pulse: the "Breadth" line quotes exchange A/D for the day, NIFTY 500 %>50/200 DMA, the
score and label, and any divergence or thrust. Don't infer breadth from index points.india-market-analyst: put the breadth label next to the regime in the context line. In a
narrow market, prefer leaders in participating sectors and cut size in small caps.breakout-planner: in a narrow tape (under 40% above the 50 DMA) demand stronger relative strength.sector-rotation has per-sector member breadth (its breadth sub-command); this is the market view.--as-of (Mar 2020, mid-2022, early 2025) before you rely on them.Breadth: [universe, N stocks / exchange A/D] to [date] | score s/100 [label] (coverage c%)
%>20/50/200 DMA a/b/c (20-session change) | uptrend u% | A/D adv/dec, 20s net, divergence [flag]
NH/NL today and 10s | McClellan osc, summation trend | thrust [state] | sectors k/m participating
Read: [one line] | Regime fit: [how it shifts the market-regime exposure ceiling]
Educational analysis, not investment advice. Data: [sources + timestamps].
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub xdhruv/claude-trading-skills-india-mv --plugin india-trading-skills36 skills in this plugin
/backtest-labBacktests rule-based swing ideas on NSE/BSE daily bars with Indian frictions built in: decide on
the close and fill at the next open, gap-through stops, slippage, exact per-trade charges by
segment and broker (STT, stamp duty, GST, DP), whole shares or lots, circuit-band no-fills,
futures-only shorts and an optional STCG/LTCG estimate. Six built-in strategies; CAGR vs
buy-and-hold, drawdown, Sharpe/Sortino, profit factor, expectancy in ₹ and R; parameter sweeps
with a plateau-or-spike read, walk-forward and Monte Carlo. backtest.py, stdlib only, offline.
Use when the user asks: "backtest this strategy", "would a 20/50 crossover have worked on X",
"is this edge real or curve-fit", "optimise my parameters", "walk-forward test", "Monte Carlo my
trades", "what drawdown should I expect", "do charges kill this idea", "does a NIFTY 200-DMA
filter help", or before putting real money behind any mechanical rule.
/breakout-plannerStage-2 breakout setups on NSE/BSE stocks: a trend-template check (rising 200 DMA, 50>150>200
stack, distance from 52-week high/low, relative strength vs NIFTY), base detection (volatility
contraction with successively tighter pullbacks, or a flat base) with pivot, depth, duration,
volume dry-up and a grade, then an order-ready plan: trigger, chase limit, capped stop, size,
Indian charges, R targets, GTT/SL templates, circuit-band and NSE tick-size checks. breakout.py
scans a folder of CSVs or yfinance symbols and ranks them, offline-capable.
Use when the user asks: "is X in a Stage 2 uptrend", "find VCP setups", "where is the pivot on X",
"plan a breakout trade in X", "breakout buy point and stop", "scan these stocks for breakouts",
"Minervini trend template for NSE stocks", "how do I place a GTT for a breakout", or any question
about buying stocks as they clear a base.
2 plugins ship this exact skill · first indexed Nov 4, 2026
Other plugins' skills for the same job