TAKline
相同三只乌鸦 (Identical 3 Crows)
TA.CDLIDENTICAL3CROWS() - 看跌反转形态
语法
python
result = TA.CDLIDENTICAL3CROWS(records)参数
| 参数 | 类型 | 说明 |
|---|---|---|
| records | array | K线数据数组 |
返回值
- -100: 看跌反转信号
- 0: 无信号
形态特征
相同三只乌鸦是三日看跌反转形态:
- 三根连续黑色K线
- 每根开盘价接近前一根收盘价
- 收盘价连续走低
- 三根K线大小相近("相同")
比普通三只乌鸦更规则,信号更强。
信号解读
- 看跌反转 (-100)
- 上涨趋势末期出现
- 三根相似黑线显示卖压持续
- 每天都低开低走
- 强烈的见顶信号
使用示例
python
def onTick():
exchange.SetContractType("swap")
records = exchange.GetRecords()
if len(records) < 100:
return
# 检测相同三只乌鸦
crows3 = TA.CDLIDENTICAL3CROWS(records)
if crows3[-1] == -100:
ma20 = TA.MA(records, 20)
if records[-3].Close > ma20[-3]: # 前三天在均线上方
rsi = TA.RSI(records, 14)
if rsi[-1] < 50: # RSI已经下穿50
Log("检测到相同三只乌鸦,强烈见顶信号")
# 平掉所有多单
position = exchange.GetPosition()
for pos in position:
if pos.Type == 0: # 多单
exchange.SetDirection("closebuy")
exchange.Sell(-1, pos.Amount)
# 开空单
exchange.SetDirection("sell")
exchange.Sell(-1, 1)