衷心感谢!
示例代码
Function GetLastPrice(Formula)
'系统会在逐K线模式解释公式时的每个周期都会调用此函数一遍,因此设计时应该注重程序的执行效率,不要重复的执行一些没必要的代码
GetLastPrice=0
if order.TradeCount2 < 1 then
exit function
End if
if Formula.WorkMode = 0 and Formula.IsLastBar = 0 then
exit function
End if
dim date
dim code
dim market
dim ordertype
dim Action
dim Price
dim Volume
dim Kaiping
'读取第一个成交记录
order.TradeDetalied2 0,date,code,market,ordertype,action,price,volume,Kaiping
'返回得到的最后一个成交记录中的成交价格
GetLastPrice price
End Function
首选你要建立一个 GetLastPrice 自定义函数,然后将上面的代码贴过去就可以了