求一个函数,输入价格,返回这个价位上我委托的挂单数量,多单空单区分,如何自编此函数
dim temp
for i=0 to order.OrderNum2-1
call order.OrderInfo2(i, OrderID, ConSign, Filled, Remaining, Action, OrderType, LmtPrice, Account, Kaiping, Code, Market)
if LmtPrice = a then
temp = Remaining
end if
next
算法如上,自己通过自定义函数完善下
不要用拿来主义,如果不能用,自己分析原因,自己尝试改进
function ORDERNUM(a)
dim temp
for i=0 to order.OrderNum2-1
call order.OrderInfo2(i, OrderID, ConSign, Filled, Remaining, Action, OrderType, LmtPrice, Account, Kaiping, Code, Market)
if LmtPrice = a then
temp = Remaining
end if
next
ORDERNUM=temp
End Function
vba要处于启动状态,另外请从函数列表-自定义函数,从这里右键添加自定义函数,系统会自动生成代码段的。
此主题相关图片如下:wf~thmua01mg3sgv6ktv6ns.png

还是返回不了,能不能麻烦把这个能返回的完整的自定义函数代码发一下?
我们是新手,水平低,不够专业,我错了!真不该买你们2套专业版了,浪费了!