Files
sanguo_quant_live/zhangfei-technical/research/task-20260417-atr-indicator/README.md
T
2026-04-17 20:23:03 +08:00

56 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ATR指标计算工具开发任务
## 任务信息
- **任务ID**: multi-review-test-004
- **任务名称**: 多阶段评审测试 - 张飞开发→司马懿→关羽→司马懿
- **当前节点**: zhangfei_implement - 张飞 - 指标开发
- **开始日期**: 2026-04-17
## 需求说明
开发一个简单ATRAverage True Range)指标计算工具
## 需求分解
### 1. TRTrue Range)计算
TR计算公式:
```
TR = max[
|high - low|,
|high - previous_close|,
|low - previous_close|
]
```
### 2. ATR计算
ATR是TR的移动平均,支持两种方式:
1. **SMA(简单移动平均)**: 普通算术平均
2. **EMA(指数移动平均)**: 平滑指数加权平均
### 3. 接口设计
- 支持pandas DataFrame输入
- 支持自定义周期参数
- 返回ATR序列
- 完整的错误处理
### 4. 示例代码
- 使用实际数据演示ATR计算
- 展示两种计算方式的区别
## 开发计划
1. ✅ 创建任务目录
2. ⬜ 实现TR计算函数
3. ⬜ 实现SMA-ATR计算
4. ⬜ 实现EMA-ATR计算
5. ⬜ 封装完整类接口
6. ⬜ 编写示例代码
7. ⬜ 自测验证
8. ⬜ 提交给司马懿评审
## 产出物
- `atr_indicator.py`: 主要实现代码
- `example.py`: 示例代码
- `test_atr.py`: 单元测试
## 参考资料
- ATR简介: https://baike.baidu.com/item/%E5%B9%B3%E5%9D%87%E7%9C%9F%E5%B8%83%E6%B3%A2%E5%B9%85/10323008