xiaohongshu
xiaohongshu
detect-atr-squeeze-regime
以 14 日指數平滑 ATR 偵測市場是否從秩序型趨勢轉為波動主導的擠壓(squeeze)行情,並輸出對技術位、停損、交易持有期的可行性評估。
Full skill instructions
<essential_principles>
<principle name="atr_percent_normalization"> **ATR% 標準化核心**傳統 ATR 是絕對值(價格單位),不同價位資產無法比較。 將 ATR 轉換為百分比(ATR / Close * 100)後:
ATR% = (14-day EMA of True Range) / Close * 100
Ratio = Current ATR% / 3-year Rolling Mean ATR%
</principle>
<principle name="three_regime_classification"> **三行情分類**| 行情 | ATR% 條件 | Ratio 條件 | 市場特徵 |
|---|---|---|---|
orderly_market | 常態區間 | < 1.2 | 技術位有效、停損精準、趨勢追蹤可靠 |
elevated_volatility_trend | 偏高 | 1.2 - 2.0 | 技術位減效、需放寬停損、仍有方向性 |
volatility_dominated_squeeze | >= 高波門檻 | >= 2.0 | 技術位失靈、停損頻被掃、反身性主導 |
擠壓行情的判定需要同時滿足:
high_vol_threshold_pct(預設 6%)spike_threshold_x(預設 2.0)
</principle>當進入 volatility_dominated_squeeze 行情:
價格運動被「被迫流」主導:
技術位可靠度下降:
停損脆弱性:
當偵測到擠壓行情時:
| 調整項目 | 秩序市場 | 擠壓行情 |
|---|---|---|
| 停損倍數 | 1.0-1.5 ATR | 2.0-3.0 ATR |
| 倉位縮放 | 正常 | 降至 1/ATR% |
| 時間框架 | 日內/短線 | 切換到較長週期 |
| 工具選擇 | 裸倉位 | 期權/價差結構 |
| 技術位信任 | 高 | 低(視為雜訊) |
| </principle> |
</essential_principles>
<objective> 偵測資產是否進入「波動主導的擠壓行情」:輸出:行情判定、ATR% 數值、倍率、可操作的風控建議。 </objective>
<quick_start>
最快的方式:偵測白銀(SI=F)
cd skills/detect-atr-squeeze-regime
pip install pandas numpy yfinance pandas_ta # 首次使用
python scripts/atr_squeeze.py --symbol SI=F --quick
輸出範例:
{
"symbol": "SI=F",
"as_of": "2026-01-14",
"regime": "volatility_dominated_squeeze",
"atr_pct": 7.23,
"atr_ratio_to_baseline": 2.41,
"tech_level_reliability": "low",
"tech_level_reliability_score": 28,
"suggested_stop_atr_mult": 2.5,
"position_scale": 0.41
}
完整分析:
python scripts/atr_squeeze.py --symbol XAGUSD --start 2020-01-01 --end 2026-01-01 --output result.json
生成視覺化儀表盤:
pip install matplotlib # 首次使用
python scripts/plot_atr_squeeze.py --symbol SI=F --output output/
儀表盤包含:
</quick_start>
<intake> 需要進行什麼操作?請選擇或直接提供資產代碼開始分析。 </intake>
<routing> | Response | Action | |----------------------------------|----------------------------------------------| | 1, "快速", "quick", "check" | 執行 `python scripts/atr_squeeze.py --quick` | | 2, "掃描", "scan", "multiple" | 閱讀 `workflows/monitor.md` 並執行 | | 3, "回測", "backtest", "history" | 閱讀 `workflows/backtest.md` 並執行 | | 4, "監控", "monitor", "alert" | 閱讀 `workflows/monitor.md` 並執行 | | 5, "學習", "方法論", "why" | 閱讀 `references/methodology.md` | | 提供 symbol (如 SI=F, GC=F) | 閱讀 `workflows/detect.md` 並使用參數執行 |路由後,閱讀對應文件並執行。 </routing>
<directory_structure>
detect-atr-squeeze-regime/
├── SKILL.md # 本文件(路由器)
├── skill.yaml # 前端展示元數據
├── manifest.json # 技能元數據
├── workflows/
│ ├── detect.md # 單資產偵測工作流
│ ├── monitor.md # 多資產監控工作流
│ └── backtest.md # 歷史回測工作流
├── references/
│ ├── methodology.md # ATR 擠壓行情方法論
│ ├── input-schema.md # 完整輸入參數定義
│ └── data-sources.md # 資料來源說明
├── templates/
│ ├── output-json.md # JSON 輸出模板
│ └── output-markdown.md # Markdown 報告模板
├── scripts/
│ ├── atr_squeeze.py # 主偵測腳本
│ └── plot_atr_squeeze.py # 視覺化儀表盤腳本
└── examples/
└── xagusd-squeeze-2024.json # 範例輸出
</directory_structure>
<reference_index>
方法論: references/methodology.md
資料來源: references/data-sources.md
輸入參數: references/input-schema.md
</reference_index>
<workflows_index>
| Workflow | Purpose | 使用時機 |
|---|---|---|
| detect.md | 單資產偵測 | 需要檢查特定資產 |
| monitor.md | 多資產監控 | 日常掃描或警報 |
| backtest.md | 歷史回測 | 驗證識別準確性 |
| </workflows_index> |
<templates_index>
| Template | Purpose |
|---|---|
| output-json.md | JSON 輸出結構定義 |
| output-markdown.md | Markdown 報告模板 |
| </templates_index> |
<scripts_index>
| Script | Command | Purpose |
|---|---|---|
| atr_squeeze.py | --symbol SI=F --quick | 快速檢查當前狀態 |
| atr_squeeze.py | --symbol SI=F --start DATE | 完整歷史分析 |
| atr_squeeze.py | --scan SI=F,GC=F,CL=F | 多資產掃描 |
| plot_atr_squeeze.py | --symbol SI=F --output output/ | 生成視覺化儀表盤 |
| </scripts_index> |
<input_schema_summary>
核心參數
| 參數 | 類型 | 預設值 | 說明 |
|---|---|---|---|
| symbol | string | (required) | 資產代碼 |
| start_date | string | today-5y | 取樣開始日 |
| end_date | string | today | 取樣結束日 |
| timeframe | string | 1d | 價格頻率 |
ATR 參數
| 參數 | 類型 | 預設值 | 說明 |
|---|---|---|---|
| atr_period | int | 14 | ATR 週期 |
| atr_smoothing | string | ema | 平滑法(ema/wilder) |
| use_percent_atr | bool | true | 是否轉為百分比 |
行情判定參數
| 參數 | 類型 | 預設值 | 說明 |
|---|---|---|---|
| baseline_window_days | int | 756 | 長期基準窗口(約 3 年) |
| spike_threshold_x | number | 2.0 | 倍率門檻 |
| high_vol_threshold_pct | number | 6.0 | 絕對 ATR% 高波動門檻 |
完整參數定義見 references/input-schema.md。
</input_schema_summary>
<output_schema_summary>
{
"skill": "detect-atr-squeeze-regime",
"symbol": "SI=F",
"as_of": "2026-01-14",
"regime": "volatility_dominated_squeeze",
"atr_pct": 7.23,
"atr_ratio_to_baseline": 2.41,
"baseline_atr_pct": 3.0,
"tech_level_reliability": "low",
"tech_level_reliability_score": 28,
"risk_adjustments": {
"suggested_stop_atr_mult": 2.5,
"position_scale": 0.41,
"recommended_timeframe": "weekly",
"instrument_suggestion": "options_or_spreads"
},
"interpretation": {
"regime_explanation": "...",
"tactics": ["...", "..."]
}
}
完整輸出結構見 templates/output-json.md。
</output_schema_summary>
<success_criteria> 執行成功時應產出:
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience