公式:DIFF := EMA(CLOSE,12) - EMA(CLOSE,26);DEA := EMA(DIFF,9);
MACD1 := 2*(DIFF-DEA);
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:=SMA(RSV,3,1);
D:=SMA(K,3,1);
KDJbuyCOND:=count(cross(k,d),10)>=1;
MACDbuyCOND:=count(cross(DIFF,DEA),3)>=1 and MACD1>0;
KDJsellCOND:=count(cross(d,k),10)>=1;
MACDsellCOND:=count(cross(DEA,DIFF),3)>=1 and MACD1<0;
KaiDuoCond:KDJbuyCOND and MACDbuyCOND;
KaiKongCond:KDJsellCOND and MACDsellCOND;
macd30:=MACD1;
macd30b:=REF(macd30,1);
macd30b2:=REF(macd30,2);
PingDuoCond:macd30b>macd30 and macd30b2>macd30b;
PingKongCond:macd30b<macd30 and macd30b2<macd30b;
Sub MARKETDATA_ReportNotify(ReportData) '行情触发时的操作
NewPrice = ReportData.NewPrice
'application.MsgOut cdate(time) & (NewPrice>(TraderForm_adjustPrice.value-5) and
NewPrice<(TraderForm_adjustPrice.value+5))
NewBuyPrice=ReportData.BuyPrice1
NewSellPrice=ReportData.SellPrice1
'stkLable=ReportData.Label
Set Formula=marketdata.STKINDI(Tcode,Tmarket,"TradeCond",0,17)
KaiDuoCond=Formula.GetBufData("KaiDuoCond",Formula.DataSize-1)
PingDuoCond=Formula.GetBufData("PingDuoCond",Formula.DataSize-1)
KaiKongCond=Formula.GetBufData("KaiKongCond",Formula.DataSize-1)
PingKongCond=Formula.GetBufData("PingKongCond",Formula.DataSize-1)
application.MsgOut "KaiDuoCond:" &
KaiDuoCond
application.MsgOut "KaiKongCond:" & KaiKongCond
application.MsgOut "PingDuoCond:" & PingDuoCond
application.MsgOut "PingKongCond:" & PingKongCond
set Formula=nothing
后面还有一些代码,在此省略
End Sub
问题:打印的PingKongCond的值与公式在图表中显示的值不一样,比如,公式的值已经变成0,在VBA中打印的值还是1,为何呢?