【12.30帖子恢復(fù)】dsyang [求助]自定義函數(shù)應(yīng)用
作者:金字塔 來源:cxh99.com 發(fā)布時間:2015年07月11日
- 咨詢內(nèi)容:
金字塔里程序調(diào)用 自己定義函數(shù),出問題
macd_sp1:=stkindi(sp1,'macd.macd1',0,dotime,0);
macd_sp1_1:=stkindi(sp1,'macd.MACD1',0,dotime,-1);
macd_sp1_2:=stkindi(sp1,'macd.MACD1',0,dotime,-2);
csp1:=checkmacd(macd_sp1,macd_sp1_1,macd_sp1_2); //調(diào)用自定義函數(shù)
vba 里的函數(shù)
Function checkmacd(Formula,sn1,sn2,sn3)
'系統(tǒng)會在逐K線模式解釋公式時的每個周期都會調(diào)用此函數(shù)一遍,因此設(shè)計時應(yīng)該注重程序的執(zhí)行效
率,不要重復(fù)的執(zhí)行一些沒必要的代碼
checkmacd=0
if sn1>0 and sn2<0 then checkmacd=1
if sn1>0 and sn2>0 and sn3<0 then checkmacd=1
if sn1<0 and sn2>0 then checkmacd=-1
if sn1<0 and sn2<0 and sn3>0 then checkmacd=-1
imsgBox checkmacd
End Function
出現(xiàn)vba 類型不匹配 13 是什么原因,麻煩告訴我一下,順便 告訴我 vba怎么輸出 消息到窗口,我主要是想看我的變量值是不是計算對了
- 金字塔客服:
您好,對應(yīng)使用逐K線模式試試