/india-trading-skills:position-sizingfrom india-trading-skills
Calculates position sizes for Indian equity and F&O trades using fixed-fractional risk, ATR-based stops, lot rounding, margin checks, MTF/intraday leverage, gap-through-stop risk, and Kelly criterion from a trade journal.
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.
Sizing decides survival. Risk a small, fixed fraction of capital per trade so that a losing streak, which will happen, is survivable.
# Equity, structure stop
python3 scripts/risk.py size --capital 500000 --risk-pct 1 --entry 1450 --stop 1410
# Equity, ATR stop + gap-risk check for a midcap
python3 scripts/risk.py size --capital 500000 --risk-pct 1 --entry 1450 --atr 28 --atr-mult 2 --cap midcap
# NIFTY futures: lot rounding + margin
python3 scripts/risk.py size --capital 800000 --risk-pct 1 --entry 24950 --stop 24800 --lot-size 65 \
--margin-per-lot 165000 --cost-pct 0.06
# MTF at 3x
python3 scripts/risk.py size --capital 300000 --risk-pct 1 --entry 820 --stop 790 --leverage 3
# Win rate / payoff / Kelly from your journal (date,symbol,side,entry,exit,stop,qty,charges | or pnl)
python3 scripts/risk.py journal trades.csv
--cost-pct is the round-trip cost as % of entry. Use about 0.25 for delivery, 0.05 for intraday,
and 0.06 for index futures, or compute it exactly with trading-costs. Get margin per lot from the
broker's margin calculator or the MCP margin tool, because SPAN changes daily.
Risk budget = Capital × Risk% (÷ leverage when using MTF/MIS margin)
Units = Budget ÷ (|Entry − Stop| + cost per unit)
F&O = floor(Units ÷ lot size) lots
| Situation | Risk % per trade |
|---|---|
| Normal swing/positional, no leverage | 0.5–1% (max 2%) |
| New or unproven setup | 0.25–0.5% |
| With MTF/MIS leverage | base risk ÷ leverage (see below) |
| F&O beginners | 0.5%, and only defined-risk structures |
| Total open risk across all positions | ≤ 6% |
Why divide by leverage? The loss at the stop doesn't depend on leverage. But leverage lets a
position grow beyond your cash, so a gap through the stop or a margin call hurts far more.
risk.py --leverage therefore divides the risk budget by the leverage as a deliberate safety
haircut. Pass --leverage 1 if you want the plain calculation.
Example: capital ₹10 lakh, 2% risk, entry ₹1,800, stop ₹1,700. Without costs that is 200 shares. With 0.25% round-trip costs, risk per share is ₹104.5, so 191 shares. That is ₹3.44 lakh, 34% of capital, which breaches the 20% single-stock cap, so cap at about 111 shares unless the user accepts the concentration.
Stop = Entry − ATR(14) × k k: 1.5 (calm, ADX<20) | 2.0 (normal) | 2.5 (volatile, ADX>30)
Volatile stocks automatically get smaller size. Get ATR from ta.py summary.
Kelly% = W − (1 − W) / R W = win rate, R = avg win / avg loss
Kelly gives the fraction of capital to risk per trade, not to invest. Use at most half-Kelly and
never more than 2%. risk.py journal computes W, R, profit factor, drawdown and Kelly from a CSV.
--margin-per-lot, risk.py size caps
lots at that limit automatically (--max-margin-pct changes it). Margins rise on volatility spikes, on expiry
day (+2% ELM on shorts), and for stock F&O in expiry week (physical delivery).--cap largecap|midcap|smallcap (3/5/10%) or --gap-pct shows the loss
if price gaps beyond the stop. Results, global sell-offs and regulatory news gap Indian stocks
overnight.| Constraint | Limit |
|---|---|
| Single stock | ≤ 20% of capital (≤ 10% small caps) |
| Single sector | ≤ 35% |
| Total open risk (sum of stop distances) | ≤ 6% |
| Correlated names in one sector | ≤ 3 |
| F&O margin used | ≤ 50% of capital |
Position: N shares / L lots (qty Q)
Entry ₹E | Stop ₹S (x% away, method) | Value ₹V (y% of capital) | Margin ₹M
Risk if stopped: ₹R (r% incl. costs) | Gap-through loss: ₹G (g%)
Notes: [caps applied, lot too big, leverage adjustment, liquidity]
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 1, 2026
Other plugins' skills for the same job