TAKline
短线 (Short Line)
TA.CDLSHORTLINE() - 中性识别形态
语法
python
result = TA.CDLSHORTLINE(records)参数
| 参数 | 类型 | 说明 |
|---|---|---|
| records | array | K线数据数组 |
返回值
- 100: 检测到短线K线
- 0: 无短线K线
形态特征
短线是单日中性形态:
- 实体很短
- 影线也较短
- 整根K线高度较小
- 显示市场波动小,交易清淡
信号解读
- 市场平静 (100)
- 波动率降低
- 交易不活跃
- 可能在酝酿变盘
- 单独使用意义不大
应用场景:
- 连续出现多根短线:盘整期
- 趋势中出现短线:可能是中继
- 需要结合其他形态判断
使用示例
python
def onTick():
exchange.SetContractType("swap")
records = exchange.GetRecords()
if len(records) < 100:
return
# 检测短线
shortline = TA.CDLSHORTLINE(records)
# 统计连续短线数量
short_count = 0
for i in range(-1, -6, -1):
if i >= -len(shortline) and shortline[i] == 100:
short_count += 1
else:
break
if short_count >= 3:
Log(f"连续{short_count}根短线,市场盘整")
# 计算布林带宽度
bbands = TA.BBANDS(records, 20, 2)
width = (bbands[0][-1] - bbands[2][-1]) / bbands[1][-1]
if width < 0.02: # 布林带收窄
Log("市场极度平静,警惕突破")
# 等待突破信号
# 可以设置双向挂单等待突破