Macro-skills cost-density-net-rr-calculator
displayName: 計算成本密度淨風報比
git clone https://github.com/fatfingererr/macro-skills
skills/cost-density-net-rr-calculator/skill.yamldisplayName: 計算成本密度淨風報比 emoji: "🧮" authorUrl: https://github.com/fatfingererr/macro-skills
tools:
- claude-code
featured: false installCount: 0
testQuestions:
- question: '計算 XAU/USD 在停損 20 pips 時的淨風險報酬比(佣金 $7,點差 1.5 pips)'
expectedResult: |
此技能會:
- 計算成本密度 = (7/10 + 1.5) = 2.2 pips
- 計算負載係數 x = 2.2/20 = 0.11
- 計算 RR_net = (3.0 - 0.11)/(1 + 0.11) = 2.60
- 計算 WR_min = (1 + 0.11)/(1 + 3.0) = 27.7%
- question: '掃描停損從 5 到 50 pips,找出 RR_net 下降 20% 的臨界點'
expectedResult: |
此技能會產生 P vs RR_net 表格,標記:
- RR_net > 0 的最小 P
- Loss_RR 達到 20%、40% 的 P 值
- P_critical(效率減半點)
- question: '分析為何微型時間框架策略難以獲利'
expectedResult: |
此技能會解釋:
- 縮小停損導致成本雙曲線增長
- 精確度需求與訊號品質的「剪刀效應」
- 建議在回測中用 RR_net 替代 RR_g
qualityScore: overall: 37 badge: 初級 evaluatedAt: "2026-01-23"
metrics: problemFit: 50 correctness: 40 dataGovernance: 30 robustness: 32 maintainability: 38 usability: 32
metricDetails: problemFit: score: 50 strengths: - 數學公式推導完整 - 理論來源有學術文獻 improvements: - Alpha 階段,功能未完善 - testQuestions 的 expectedResult 過於簡略
correctness: score: 40 strengths: - 有完整數學推導 - 包含實際案例(XAU/USD) improvements: - expectedResult 缺少實際計算輸出 - 公式驗證不足 dataGovernance: score: 30 strengths: - 純計算無外部數據依賴 - 參數定義清楚 improvements: - 缺少 data-sources.md - 實際交易成本數據來源不明 robustness: score: 32 strengths: - pitfalls 詳列單位混淆風險 - bestPractices 有單位一致性建議 improvements: - 缺少 failure-modes.md - Alpha 階段未經測試 - 輸入驗證不完整 maintainability: score: 38 strengths: - 工作流程分離設計 - 公式參考文件獨立 improvements: - 可增加 manifest.json 版本控制 - Alpha 階段缺少腳本實作 usability: score: 32 strengths: - FAQ 解答核心概念 - 有理論來源說明 improvements: - expectedResult 需完善 - 缺少實際使用範例
details: | 任務適配度(50/100) - 數學公式推導完整 - 待改進:Alpha 階段未完善
**正確性(40/100)** - 有數學推導 - 待改進:缺少計算輸出 **資料治理(30/100)** - 純計算無依賴 - 待改進:成本數據來源 **穩健性(32/100)** - pitfalls 詳列風險 - 待改進:Alpha 未測試 **可維護性(38/100)** - 工作流程分離 - 待改進:缺少腳本 **輸出可用性(32/100)** - FAQ 解答概念 - 待改進:缺少範例
upgradeNotes: targetBadge: 中級 requirements: - metric: correctness currentScore: 40 targetScore: 55 suggestion: 完善 expectedResult 與計算輸出 - metric: robustness currentScore: 32 targetScore: 50 suggestion: 完成 Alpha 階段測試 - metric: usability currentScore: 32 targetScore: 50 suggestion: 增加實際使用範例
bestPractices:
- title: 確保單位一致性 description: P(停損)和 s(點差)必須使用相同的 pip/point 基準
- title: 使用 RR_net 進行回測 description: 微型時間框架回測應使用 RR_net 而非 RR_g
- title: 監控 P_critical 閾值 description: 停損低於 P_critical 時,策略進入高摩擦區
- title: 考慮滑點影響 description: 此模型假設理想執行,實際交易需額外考慮滑點
pitfalls:
- title: 單位混淆 description: P 使用 pips 但 s 使用 points,或 c 不是 round-turn consequence: 計算結果完全錯誤
- title: 忽略 R 的無關性 description: 誤以為改變固定風險 R 會影響 RR_net consequence: 錯誤的部位規模決策
- title: 線性外推 description: 假設縮小停損會線性降低效率 consequence: 低估微型時間框架的成本衝擊
faq:
-
question: 為什麼 RR_net 與 R(固定風險)無關? answer: | 在固定風險框架中,部位規模 = R / (P × V)。 當推導 RR_net 時,R 在分子分母同時出現並抵消, 證明效率衰減與帳戶規模無關,僅取決於 RR_g、P 和成本密度。
-
question: 什麼是「獲利事件視界」? answer: | 當停損縮小到某個臨界值以下,無論預測準確度多高, 正期望值都變得統計上不可能達成。這個閾值稱為「事件視界」, 類似於黑洞的概念——一旦越過,就無法逃脫負期望值。
-
question: P_critical 如何計算? answer: | P_critical = CostDensity × (RR_g + 2) / RR_g
這是策略效率減半(RR_net = 0.5 × RR_g)時的停損大小。 低於此值進入高摩擦區,效率急劇下降。
about: repository: https://github.com/fatfingererr/macro-skills branch: main additionalInfo: | ## 理論來源
基於 Sergei Sukhov 的論文: "Geometry of Advantage Decay: A Quantitative Model for Risk-Reward Degradation in High-Friction Trading Environments" ## 相關文獻 - Kyle (1985): Continuous Auctions and Insider Trading - Glosten & Milgrom (1985): Bid-ask spread models - Easley & O'Hara (1987): Price, trade size, and information