TAMomentum
TA.AROON() - 阿隆指标
阿隆指标 (Aroon Indicator)
识别趋势变化和趋势强度的指标。
语法
python
TA.AROON(high, low, timeperiod=14)参数
| 参数名 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
| high | any | 否 | - | 最高价数组 |
| low | any | 否 | - | 最低价数组 |
| timeperiod | any | 否 | - | 时间周期,默认14 |
返回值
返回 (aroondown, aroonup) 元组,范围0-100。
计算方法
plaintext
Aroon Up = ((period - 周期内最高价距今天数) / period) × 100
Aroon Down = ((period - 周期内最低价距今天数) / period) × 100信号解读
- Aroon Up > 70: 强势上升趋势
- Aroon Down > 70: 强势下降趋势
- Aroon Up 上穿 Aroon Down: 趋势转多
- Aroon Down 上穿 Aroon Up: 趋势转空
基础示例
python
def main():
while True:
records = exchange.GetRecords()
if len(records) < 30:
Sleep(1000)
continue
highs = [r['High'] for r in records]
lows = [r['Low'] for r in records]
aroondown, aroonup = TA.AROON(highs, lows, 14)
Log(f"Aroon Up: {aroonup[-1]:.1f}, Down: {aroondown[-1]:.1f}")
if aroonup[-1] > 70 and aroondown[-1] < 30:
Log("✅ 强势上升趋势")
elif aroondown[-1] > 70 and aroonup[-1] < 30:
Log("❌ 强势下降趋势")
# 交叉信号
if aroonup[-1] > aroondown[-1] and aroonup[-2] <= aroondown[-2]:
Log("💡 Aroon金叉")
Sleep(60000)