等级: 免费版
- 注册:
- 2021-5-31
- 曾用名:
|
vb通过python计算出画线坐标,然后画图,vb代码如下:
sub drawTrend(Grid,i,r,g,b)
Dim td_data,Msg
set td_data = yc_py.CallObject("get_middle_trend",i)
If IsEmpty(td_data) Then
Msg = yc_py.GetErrorInfo()
Application.MsgOut Msg
Set Msg = Nothing
Exit Sub
End If
Dim len
len=Cint(td_data.GetAt(0))
if td_data.GetAt(0)=-1 then
debug("获取趋势出错!")
exit sub
elseif td_data.GetAt(0)=0 then
debug("没有趋势数据")
exit sub
else
Dim price_index,start_index,start_price,end_index,end_price
for i=1 to len-1
price_index=(len+1)+i
start_index= Grid.PelsByPos(td_data.GetAt(i+1))
start_price= Grid.PriceToPels(td_data.GetAt(price_index+1))
end_index=Grid.PelsByPos(td_data.GetAt(i+1+1))
end_price=Grid.PriceToPels(td_data.GetAt(price_index+1+1))
call Grid.DrawLine(start_index,start_price,end_index,end_price,rgb(r,g,b),1,2)
next
end if
set td_data=nothing
end sub
|
|