下面是pel简语言调用python缠论技术指标的代码:
[PEL] 复制代码 //调用缠论技术指标,获取最后一笔的顶底分型
Py_Import czsc_ind_v2;
//触发Python中的Handle_bar方法
FIREPYHANDLEBAR;
//获取缠论最后一笔的顶底分型位置,若顶分型在倒数第3根K线,则high_bar_index返回3;若底分型在倒数第5根K线,则low_bar_index返回5
high_bar_index:=GETPYTHONVAL('high_bar_index');
low_bar_index:=GETPYTHONVAL('low_bar_index');
//问题:如何在K线上标记出来最近1笔的缠论高低点? [还可以返回最近顶底分型的K线日期,python里面返回什么数据都可以]
drawtext(high_bar_index > 0 and BARPOS=DATACOUNT-high_bar_index, REF(H,high_bar_index)+50, '●', COLORGREEN), ALIGN0;
drawtext(low_bar_index > 0 and BARPOS=DATACOUNT-low_bar_index, REF(L,low_bar_index)-50, '●', COLORRED), ALIGN0;
问题:如何在K线上标记出来最近1笔的缠论高低点?
金字塔技术指标渲染时是逐根K线调用python技术指标,czsc_ind_v2 技术指标会实时返回最近一个高低点,日志如下:
[Python] 复制代码 2025-06-12 09:09:27.380 to_raw_bar : {'symbol': 'SH000001', 'datetime': '20240624000000', 'open': 558.5599975585938, 'high': 559.47998046875, 'low': 549.260009765625, 'close': 550.6400146484375, 'volume': 144.0, 'open_interest': 146.0}
2025-06-12 09:09:27.395 bar now : 2024-06-24 00:00:00, barpos : 64, frequency : 1d, datacount : 108, start_date : 2023-06-08 00:00:00, end_date : 2025-06-11 00:00:00
2025-06-12 09:09:27.411 bar now : 2024-06-24 00:00:00, 20240624000000 满足底点条件:6
2025-06-12 09:09:27.426 bar now : 2024-06-24 00:00:00, 20240624000000 满足高点条件:1
2025-06-12 09:09:27.442 to_raw_bar : {'symbol': 'SH000001', 'datetime': '20240625000000', 'open': 551.2000122070312, 'high': 552.97998046875, 'low': 549.1400146484375, 'close': 550.2999877929688, 'volume': 130.0, 'open_interest': 138.0}
2025-06-12 09:09:27.442 bar now : 2024-06-25 00:00:00, barpos : 65, frequency : 1d, datacount : 108, start_date : 2023-06-08 00:00:00, end_date : 2025-06-11 00:00:00
2025-06-12 09:09:27.457 bar now : 2024-06-25 00:00:00, 20240625000000 满足底点条件:7
2025-06-12 09:09:27.473 bar now : 2024-06-25 00:00:00, 20240625000000 满足高点条件:2
2025-06-12 09:09:27.489 to_raw_bar : {'symbol': 'SH000001', 'datetime': '20240626000000', 'open': 549.5, 'high': 550.6199951171875, 'low': 546.02001953125, 'close': 546.780029296875, 'volume': 94.0, 'open_interest': 126.0}
2025-06-12 09:09:27.489 bar now : 2024-06-26 00:00:00, barpos : 66, frequency : 1d, datacount : 108, start_date : 2023-06-08 00:00:00, end_date : 2025-06-11 00:00:00
2025-06-12 09:09:27.505 bar now : 2024-06-26 00:00:00, 20240626000000 满足底点条件:8
2025-06-12 09:09:27.520 bar now : 2024-06-26 00:00:00, 20240626000000 满足高点条件:3
drawtext 绘图函数如何在指标渲染过程中实时引用到倒数第N根K线,并在上面打标记;目前只在最后的K线标记出了顶底分型高低点
我用大语音模型尝试了近10种方案,没有一个可行;然后我查遍了你们的文档,也没看到有在指标渲染过程中,实时引用某根K线并在上面打标记;请技术人员解答一下,感谢感谢
|