衷心感謝!
示例代碼
Function GetLastPrice(Formula)
'系統(tǒng)會在逐K線模式解釋公式時的每個周期都會調(diào)用此函數(shù)一遍,因此設(shè)計時應(yīng)該注重程序的執(zhí)行效率,不要重復(fù)的執(zhí)行一些沒必要的代碼
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 自定義函數(shù),然后將上面的代碼貼過去就可以了