/india-trading-skills:sector-rotationfrom india-trading-skills
Analyzes sector rotation across NSE indices using relative strength, RRG-style quadrants, DMA distances, and cyclical-vs-defensive tilt. Useful for identifying leading/fading sectors and market context before stock selection.
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.
Find where relative strength is building and where it is fading, then fish for setups in the strongest groups. This is a context filter: it tells you which pond, not which fish or when.
python3 scripts/sectors.py rotation # Yahoo (pip install yfinance), default universe
python3 scripts/sectors.py rotation --csv-dir nse_idx/ # offline: one CSV per index + "NIFTY 50.csv"
python3 scripts/sectors.py rrg --sectors IT,BANK,METAL,PSUBANK --tail 10 # weekly trail, for plotting
python3 scripts/sectors.py breadth --members members.csv --csv-dir stocks/
python3 scripts/sectors.py universe # tickers and Yahoo coverage
--json gives raw output. Options: --weeks 8 (quadrant-change look-back), --smooth 3 --window 10 --momentum 4 (RRG settings, weeks), --period 2y, --ticker NAME=TICKER / --map file.json to
override or add tickers (--ticker NIFTY=^CRSLDX benchmarks against NIFTY 500).
Offline CSVs: download each index from niftyindices.com (Historical Data, price index). Name each
file after the index ("NIFTY IT.csv", "NIFTY PSU BANK.csv"); names are matched to keys
automatically. Only a date and a close column are needed. Open/High/Low, "Shares Traded" and
"Turnover" are ignored, and no volume is required. Dates like 30 Oct 2026, 30-Oct-2026 or ISO all
parse. Daily data is best; weekly closes also work (DMAs become 10/40-week averages).
Yahoo coverage (probed 2026-10-31). History available: ^NSEI, ^NSEBANK, ^CNXIT, ^CNXAUTO,
^CNXPHARMA, ^CNXFMCG, ^CNXMETAL, ^CNXREALTY, ^CNXENERGY, ^CNXPSUBANK, ^CNXINFRA,
^CNXPSE, ^CNXCONSUM, ^CNXMNC, NIFTY_FIN_SERVICE.NS, NIFTYMIDCAP150.NS, NIFTYSMLCAP250.NS.
Quote only, no history: NIFTY MEDIA, PRIVATE BANK, HEALTHCARE, OIL & GAS, CPSE, INDIA DEFENCE,
CAPITAL MARKETS, MIDCAP 100 and SMALLCAP 100. Supply these as CSVs. Run universe for the full map.
| Metric | Definition |
|---|---|
| Returns | 1W/1M/3M/6M/12M = 5/21/63/126/252 sessions; rel = (1+sector)/(1+NIFTY) − 1 |
| RS line | 100 × sector ÷ NIFTY, sampled at each week's last close |
| RS-Ratio | 100 × EMA3(RS) ÷ SMA10 of that EMA. Above 100 = relative trend above its 10-week norm |
| RS-Momentum | 100 × RS-Ratio now ÷ RS-Ratio 4 weeks ago. Above 100 = relative trend improving |
| Quadrant | Leading (≥100/≥100) → Weakening (≥100/<100) → Lagging (<100/<100) → Improving (<100/≥100) |
| Trend | Uptrend, Downtrend, Recovering (above a falling 50 DMA), Pullback (below a rising one), Mixed |
| Rank | (RS-Ratio − 100) + (RS-Momentum − 100) |
Both axes are percentages and are not volatility-scaled, so REALTY and PSU BANK swing wider than FMCG. Compare quadrant, direction and weeks in quadrant, not raw distance. Rotation usually runs clockwise. A diagonal jump (Leading straight to Lagging) is a whipsaw near the centre. That was about 9% of quadrant changes on 10 years of NSE data; wait a second week before trusting it.
Reading it: Improving with a rising RS-Ratio is the early long watch-list. Leading plus an Uptrend is where breakouts follow through. Weakening means tighten trails and stop adding. Lagging plus a Downtrend is a short or avoid list. A sector that is only Improving but still below its 200 DMA is a bounce until its price trend confirms.
| Driver | Sectors to check | Typical read |
|---|---|---|
| FII flows (NSDL fortnightly data) | BANK, FIN SERVICE, IT | FII buying lifts private banks first; persistent selling drags them while DII-held mid/small caps hold up |
| Rupee (USD/INR) | IT, PHARMA vs importers | Weak rupee helps exporters' margins and hurts OMCs and capital-goods importers |
| Crude (Brent) | OIL & GAS, ENERGY, paints, tyres, aviation | Falling crude helps OMCs (BPCL, HPCL, IOC), paints and tyres; rising crude helps upstream (ONGC, Oil India) |
| Monsoon and rural demand (IMD, Jun–Sep) | FMCG, AUTO (tractors, 2-wheelers) | A good monsoon helps rural volumes; watch the Sep–Nov festive season |
| Union Budget (1 Feb) and capex | PSE, CPSE, INFRA, DEFENCE, PSU BANK | Capex or divestment themes run into the Budget and can fade after it |
| RBI rate cycle (MPC) | BANK, REALTY, AUTO, NBFCs (FIN SERVICE) | Cuts help realty, auto and NBFCs; banks' margins can compress early in a cutting cycle |
| Global metals and China | METAL | LME prices, China stimulus and steel safeguard duties |
breadth reports the percentage of members above their 50 and 200 DMA. --members takes a CSV of
sector,symbol, and --csv-dir holds one CSV per stock. Create the stock CSVs with
../technical-analysis/scripts/ta.py fetch --symbol TCS --out stocks/TCS.csv. Membership comes from
the index factsheet on niftyindices.com. An index Leading on fewer than 50% of members above their
50 DMA is being carried by one or two heavyweights, so its leadership is narrow.
market-pulse: fill the "Sectors" line with Leading/Improving vs Lagging, the tilt and the
size read from rotation, instead of ranking 1-week returns by hand. Suggested wording there:
"Sectors: run sector-rotation; quote quadrant leaders, tilt and size factor".india-market-analyst: at the Context stage, look up the stock's sector quadrant. Prefer longs
in Leading or Improving sectors that are in an Uptrend. Flag a long in a Lagging, Downtrend sector
as swimming against the tide. Then hand off to technical-analysis for the stock (and
multi-timeframe-analysis on the sector index itself).Sector rotation vs NIFTY 50: data to [date] ([source])
Leading: .. | Improving: .. | Weakening: .. | Lagging: ..
Tilt: [Risk-on/Defensive/Mixed]: [spread] | Size: [Broadening/Narrowing/Mixed]
Key changes ([N] weeks): [sector from→to (week)]
Watch-list: [Improving + rising RS-Ratio] | Avoid: [Lagging + Downtrend]
Drivers to verify: [FII flows / USD-INR / crude / RBI / Budget, with sources]
Educational analysis, not investment advice. Data: [sources + timestamps].
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
sector-rotation, nse, relative-strength, rrg, market-analysis, python-script
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.
/broker-integrationConnect Claude to Indian brokers and use them safely: official MCP servers for Groww, Zerodha
Kite, Dhan, Upstox, Fyers and Kotak Neo (endpoints, auth, read vs order capabilities as of Oct 2026),
tool discovery and capability mapping, saving candles for the analysis scripts, a mandatory
order-confirmation protocol, SEBI retail-algo/static-IP rules, and data fallbacks (yfinance, CSV).
Use when the user asks to connect or set up Groww/Zerodha/Kite/Dhan/Upstox/Fyers/Angel One, "fetch my
holdings/positions", "get live price", "place/modify/cancel an order", "set a GTT", "why was my order
rejected", or when another skill needs live data.
/event-calendarOffline calendar of the dates that move Indian markets: NSE/BSE F&O expiries (holiday-shifted),
exchange holidays, long weekends and special sessions, results-season windows (SEBI LODR),
trader tax dates, India macro releases (CPI, WPI, IIP, GDP, PMI, auto sales, GST, AMFI), RBI MPC,
Union Budget, US FOMC/CPI/jobs, NIFTY and MSCI rebalances, plus your own results, board-meeting,
ex-date and lock-in events. Every date is labelled computed, expected-by-rule, verified (with
source) or unverified. events.py exports .ics and answers "is there event risk in my holding
window?".
Use when the user asks: "what's on this week", "economic calendar India", "when is the next RBI
policy", "when is expiry", "is Monday a holiday", "events before my exit date", "any event risk
in this trade", "Fed meeting date", "when is CPI", "Budget date", "results season dates",
"advance tax due date", "export market calendar to Google Calendar", or before any multi-day trade.
/exhaustion-reversalWhen a move on NSE/BSE has run out of buyers or sellers. exhaustion.py scores a vertical run-up
0-100 (stretch above the 20/50/200 DMA, acceleration, run length, range/volume blow-off, late
gaps, upper-circuit streaks, price-band cuts), labels it extended, climax or reversal confirmed,
and plans the exit: scale out and trail with a GTT if you hold, or short only via stock futures or
puts on F&O names after a trigger, sized in lots. Also finds selling-exhaustion hammers for long
entries, judges whether a stock failed to react to news, and scans a universe with F&O tags.
Use when the user asks: "is this stock parabolic", "has the rally topped", "my stock hit upper
circuit five days running, should I sell", "how do I book profit on a multibagger", "can I short
this", "short a stock that ran up 80%", "capitulation or hammer setup", "selling exhaustion",
"results were good but the stock fell, what does it mean", or wants a blow-off top scan.
/fibonacci-tradingFibonacci retracement entry zones and extension targets for NSE/BSE stocks and indices, with
automatic swing detection (ta.py fib), trend-based extensions from the pullback point, and
confluence with moving averages, support/resistance, round numbers and option OI strikes.
Use when the user asks: "fib levels for X", "Fibonacci retracement", "where to buy the pullback",
"golden ratio / 61.8%", "Fib extension targets", "how far can NIFTY fall/rise from here", or gives
a swing high and low to compute levels.
2 plugins ship this exact skill · first indexed Nov 1, 2026
Other plugins' skills for the same job