等级: 免费版
- 注册:
- 2021-5-31
- 曾用名:
|
需实现的功能:在每一个分笔数据到来的时候,获得最新的未完成的k线数据(高开低收)
思路如下:在Technic_Paint()获取相关的数据,但发现获取到的k线数据偶尔会出现一个tick的延迟。请问如何解决?
代码如下:
Sub Technic_Paint()
Set Grid = Technic.GetGridByName("Main")
Set History = Grid.GetHistoryData()
Set ReportData = Grid.GetReportData()
'过滤重复行情
if last_time<>ReportData.Date Then
last_time=ReportData.Date
NewPrice=ReportData.NewPrice
stkLable=ReportData.Label
stkName=ReportData.StockName
Application.Msgout time() & "---ReportTime:" & ReportData.Date & ",Code:" & stkName & ",NewPrice:" & NewPrice
close = History.Close(History.Count-1)
open = History.Open(History.Count-1)
high = History.High(History.Count-1)
low = History.Low(History.Count-1)
dt=history.Date(History.Count-1)
Application.Msgout "notify_time:" & Cdate(Now) & ", bar_time:" & Cdate(dt) & " bardata close:" & close & ",high:" & high & ",low:" & low & ",open:" & open
debug("----------------------------------------------------------")
end if
End Sub
结果如下:
|
|