sub drawTrend(i)
Set Grid = Technic.GetGridByName("Main")
Set tzero_index = CreateObject("Stock.Array")
Set tzero_price = CreateObject("Stock.Array")
set tzero_index = py.CallObject("tzero_index",0)
If IsEmpty(tzero_index) Then
Msg = py.GetErrorInfo()
Application.MsgOut Msg
Set Msg = Nothing \'使用完毕需要 Set Nothing销毁以免出现内存泄漏
Exit Sub
End If
set tzero_price = py.CallObject("tzero_price",0)
If IsEmpty(tzero_price) Then
Msg = py.GetErrorInfo()
Application.MsgOut Msg
Set Msg = Nothing \'使用完毕需要 Set Nothing销毁以免出现内存泄漏
Exit Sub
End If
tmp_count=tzero_index.Count-2
out tmp_count
for i=0 to tmp_count
start_index=tzero_index.GetAt(i)
out "start:" & start_index & ",end:" & cstr(tzero_index.GetAt(i+1))
next
end Sub
python代码
def tzero_index(i):
#print("i:{},type:{}".format(i,type(i)))
global kcm
tdm = kcm.gms[i].tdm
p_index = tdm.start_index
p_index.append(tdm.end_index[-1])
print(p_index)
return p_index
def tzero_price(i):
global kcm
tdm = kcm.gms[i].tdm
p_price = tdm.start_price
p_price.append(tdm.end_price[-1])
#print(p_price)
return p_price
当调用tzero_index.getat方法时,读的是tzero_price的数据。
试了一下,如果我只调用python的tzero_index方法,就可以正确读出数据。
此主题相关图片如下:snipaste_2021-04-13_11-35-55.jpg