K-Line Structure Computes Support and Stops From Real Market Data
When a user wants to see the K-line structure of an A-share, Hong Kong or US stock, or an ETF or index, run the Python script bundled with this skill. It computes indicators, patterns, wave structure, support and resistance, a risk control plan, the normal price range for the next 15 trading days, and a look-ahead-free backtest directly from real daily market data, and outputs the same results as JSON, a PNG structure chart, an offline interactive dashboard and a Chinese report. The underlying tool is the open-source stock-skill (Apache-2.0, skill name kline-structure-chart, currently 6.0.0). You only relay the numbers the script computes. Do not do mental arithmetic, do not estimate prices from charts, and do not predict rises or falls.
Triggers
User says things like "analyze the K-line of Moutai / 600519.SH / Tencent / 00700.HK / NVDA", "where are the support and resistance", "where should the stop-loss go", "can this be bought", "how large will the fluctuation be over the next two weeks", "include a backtest", "look at the structure of the Shanghai Composite and ChiNext indices".
Not for: fundamentals, financial reports, news, capital flows; placing orders for the user; personalized investment advice. Such content must be marked "not reviewed" in the answer or explicitly declined.
Hard Rules
- Numbers come only from script output. Prices, levels and scores are copied exactly from
*_report.mdor*_result.json, with no rounding or rewording, and no price levels added that are not in the report. - Never output any probability, win rate or frequency. The rule score (
rule_score) is a deterministic weighted score and must not be described as a win rate. The only exception is the backtest trade win rate, which must be given together with the sample size and a 95% interval, and must be explained as not being a future probability of rising. Phrases like "high chance of breaking out" or "seven in ten odds" are also not allowed. - If real market data cannot be obtained, stop. When the script exits with
[DATA_UNAVAILABLE], tell the user honestly; do not estimate, fabricate data, or switch to other sources to fill the gap. - Check the code first; do not guess suffixes from memory. If the user gives only a name or a code without a suffix, run
scripts/resolve_symbol.pyfirst; when there are multiple candidates, list them for the user to choose and do not pick for them. - Risk veto goes first. When
verdict.risk_vetois true, the first paragraph of the answer states the reason for the veto and gives no long-side buying suggestion. - Calculate share counts only when the user provides account equity, and relay only the share count the script computes; do not divide the risk budget by the stop-loss distance yourself.
- Before answering, run
scripts/lint_response.pyto check the draft; send only when the output is"status": "OK". - End with a disclaimer: "The above is rule-based technical analysis for research reference only and does not constitute investment advice."
Installation
Check first:
ls ~/.claude/skills/kline-structure-chart/SKILL.md 2>/dev/null && echo "installed" || echo "not installed"
Requires git, Python 3.12 or above, and Pillow; analysis needs access to the Sina, Yahoo and Tencent market data interfaces; Linux chart rendering also needs a Chinese font. uv is recommended (it provisions Python 3.12 automatically and does not need sudo). If not installed, first tell the user what will be installed and where, and after they agree:
# macOS / Linux: clone to ~/.local/share/stock-skill and symlink into installed Claude Code, Codex, etc.
curl -fsSL https://raw.githubusercontent.com/xiongcp/stock-skill/main/install.sh | bash
# Windows (the author notes the install script has not yet been tested)
irm https://raw.githubusercontent.com/xiongcp/stock-skill/main/install.ps1 | iex
- If uv is missing, the script asks whether to install it; if the user declines, create a
.venvwith a local Python 3.12+ instead. Do not use sudo, and do not install dependencies into the system Python. - Other methods:
npx skills add xiongcp/stock-skill, or in Claude Code/plugin marketplace add xiongcp/stock-skillfollowed by/plugin install kline-structure-chart@stock-skill. - Re-running the install command is the update; uninstall with
bash ~/.local/share/stock-skill/install.sh --uninstall. - After installation, ask the user to open a new session and run the environment self-check once more:
uv run --directory <skill directory> python scripts/doctor.py.
Without uv, replace every uv run python below with the .venv/bin/python in the skill directory (Windows: .venv\Scripts\python). When the current directory is not the skill directory, use uv run --directory <skill directory>, and write --output-dir as an absolute path.
Process
-
Look up the code (skip when the user has already given a code with
.SH/.SZ/.BJ/.HK/.US):uv run python scripts/resolve_symbol.py 茅台 # a Chinese name, pinyin or partial code uv run python scripts/resolve_symbol.py 腾讯 --market HKUse
RESOLVEDdirectly; forAMBIGUOUS, list the candidates to the user; if a Beijing Stock Exchange stock cannot be found, ask the user for its.BJcode. -
Run the main script:
uv run python scripts/analyze_and_forecast.py --market CN --symbol 600519.SH --asset-type equity --output-dir artifacts/cn_stock -
Check the result. If any condition is not met, stop interpreting: a non-zero exit code means no price levels at all; if
quality.statusisUNAVAILABLE, give no conclusion; if it isPARTIAL, first list every warning one by one. Relay each item inquality.notes. -
Answer following the report skeleton (see "Reply Order" below), save the draft as a file, then run lint:
uv run python scripts/lint_response.py --result artifacts/cn_stock/600519.SH_result.json --response artifacts/cn_stock/reply_draft.md
Adding Parameters by Question
| What the user asks | Parameter to add |
|---|---|
| Structure, patterns, support and resistance, whether it can be bought, stop-loss and take-profit | None; read the risk control section of the report |
| How many shares to buy | --account-equity <equity>, optionally --max-risk-pct 0.01 (a ratio, not a percentage; value between 0 and 0.05) |
| Backtest, whether this rule set is reliable | --backtest (if slow, add --backtest-step 5) |
| Fluctuation range for the coming days | --horizon-bars <1~60>, default 15; describes magnitude only, not direction |
| A longer or shorter chart | --days <60~500>; changes display only, not any conclusion |
| Review a historical date | --as-of YYYY-MM-DD |
| Index or ETF | --asset-type index or etf |
| Unadjusted prices | --adjustment raw |
| Change the comparison benchmark | --benchmark <code> (default CSI 300, Hang Seng Index, SPY) |
| User provided a local real market data file | --input <file> --offline |
| Several instruments at once | Run each instrument separately and present each in its own section; never mix price levels |
Exit Codes
| Exit code | Meaning | What to do |
|---|---|---|
| 0 | Success | Interpret normally |
| 1 | Internal skill error | Tell the user honestly; do not retry with changed parameters |
| 2 | Wrong code or parameters | Look up the code with resolve_symbol.py, or correct the parameters |
| 3 | Real market data unavailable | Explain the cause and ask the user to retry later; can run doctor.py to see which data source is unreachable |
| 4 | Not enough closed K-lines | Listed too recently, --as-of too early, or the data source returned only partial history; may retry once later |
Reply Order
*_report.md is already written in this order; relay it accordingly:
- Answer the question first: one or two sentences, using only numbers from the report.
- Data notes: data source, cutoff date, adjustment basis and warnings.
- Market first: the benchmark's market state score, and the stock's strength relative to the market.
- Structure: rule score (noting it is not a win rate), the three main paths written as "trigger condition → target level → invalidation condition", the main wave count and alternatives, and pattern names.
- Risk control: if vetoed, put the reason at the top; otherwise give the entry zone, stop-loss, two-tier take-profit, time limit and the trailing break-even rule; for ChiNext and STAR Market stocks with 20% daily limits, remind not to chase highs; for Hong Kong and US short-selling plans, state both short-selling restrictions and the unaccounted securities lending fees.
- Normal 15-day fluctuation range: the 50% and 80% intervals, together with the measured coverage rate and the number of independent samples; if in the calibration observation period, state so.
- Backtest (when present): number of trades, win rate with 95% interval, cumulative return versus buy-and-hold, and the sample size warning relayed verbatim.
- Files: paths to
result.jsonanddashboard.html; attachpreview.pngwhen images can be displayed. - Disclaimer.
Output Format
A Chinese answer organized in the reply order above, plus artifact file paths: *_report.md, *_result.json, *_preview.png, *_dashboard.html, and *_backtest.json when there is a backtest. *_chart_data.json is only for charts; do not reference it.
One Sentence
The script computes the price levels from real market data; you only verify the code, copy the numbers exactly, put risks first, and never state probabilities.

Comments (0)
No comments yet. Start the conversation.