等级: 免费版
- 注册:
- 2022-11-7
- 曾用名:
|
sub test()
dim his15price(), hisdayprice(),his15,hisday
Set his15 = CreateObject("Stock.Array")
Set hisday = CreateObject("Stock.Array")
set his15=MarketData.GetHistoryData(stklabel,marketname,2,kcount)
set hisday=MarketData.GetHistoryData(stklabel,marketname,5,kcount)
data15count=his15.count
datadaycount=hisday.Count
Application.MsgOut "15分钟数据数量="&data15count
Application.MsgOut "日线数据数量="&datadaycount
redim his15price(data15count)
redim hisdayprice(datadaycount)
for i=0 to kcount-1
his15price(i)=his15.close(i)
Application.MsgOut stklabel&":his15price("&i&")="&his15price(i)
hisdayprice(i)=hisday.close(i)
Application.MsgOut stklabel&":hisdayprice("&i&")="&hisdayprice(i)
if his15price(i)=hisdayprice(i) then
Application.MsgOut "15分钟收盘价和日线收盘价相等"
end if
next
' for i=0 to kcount-1
' hisdayprice(i)=hisday.close(i)
' Application.MsgOut stklabel&":hisdayprice("&i&")="&hisdayprice(i)
' next
ema15=myema(his15price,5)
emaday=myema(hisdayprice,5)
Application.MsgOut stklabel&":ema15("&data15count-1&")="&ema15(data15count-1)
Application.MsgOut stklabel&":emaday("&datadaycount-1&")="&emaday(datadaycount-1)
MarketData.DestroyHistoryData
end sub
结果是:
AG12:his15price(364)=4634
AG12:hisdayprice(364)=4634
15分钟收盘价和日线收盘价相等
AG12:his15price(365)=4634
AG12:hisdayprice(365)=4634
15分钟收盘价和日线收盘价相等
AG12:his15price(366)=4573
AG12:hisdayprice(366)=4573
15分钟收盘价和日线收盘价相等
AG12:his15price(367)=4624
AG12:hisdayprice(367)=4624
15分钟收盘价和日线收盘价相等
AG12:his15price(368)=4741
AG12:hisdayprice(368)=4741
15分钟收盘价和日线收盘价相等
AG12:his15price(369)=4777
AG12:hisdayprice(369)=4777
15分钟收盘价和日线收盘价相等
AG12:ema15(369)=4690.051
AG12:emaday(369)=4690.051
|
|