vba數(shù)學(xué)函數(shù)
作者:金字塔 來源:cxh99.com 發(fā)布時間:2017年05月02日
- 咨詢內(nèi)容:
請問用vba編程計算兩個商品相關(guān)性要怎么做?在vba編程信息里沒有找到相關(guān)函數(shù)是不是要自己定義還是可以調(diào)用金字塔函數(shù)?
- 金字塔客服:
Array 對象
Alike 計算該數(shù)組與其他Array對象之間的相似系數(shù),例如Alike(ar)表示求與ar數(shù)組對象之間的相似度
Releate 計算該數(shù)組與其他Array對象之間的相關(guān)系數(shù)
- 用戶回復(fù):
Sub TLStart1()
call marketdata.RegReportNotify("P05","DQ")
call marketdata.RegReportNotify("Y05","DQ")End Sub
Sub MARKETDATA_ReportNotify(ReportData)
Set Report1 = marketdata.GetReportData("P05","DQ")
Set Report2 = marketdata.GetReportData("Y05","DQ") Set histroydata1 = MarketData.GetHistoryData("P05","DQ",0) Set histroydata2 = MarketData.GetHistoryData("Y05","DQ",0)
Dim data Set data = CreateObject("Stock.Array") For i =0 to 149 data.AddBack(histroydata1.Close(histroydata1.count-i)) next if data.count>150 then ata.removeat(0) end if
Dim data1 Set data1 = CreateObject("Stock.Array") For i =0 to 149 data1.AddBack(histroydata2.Close(histroydata2.count-i)) next if data1.count>150 then data1.removeat(0) end if
'相關(guān)性計算corr = data.releate(data1) application.MsgOut Cdate(time)& ",相關(guān)性:" & corr
Set d1 = nothing '釋放對象Set d2 = nothing
End Sub 請問為什么輸出的相關(guān)性數(shù)值都是1呢?是不是這么計算是錯誤的
- 網(wǎng)友回復(fù):
MarketData 對象
HistoryDataMode 歷史數(shù)據(jù)處理處理模式 0默認(rèn)值,GetHistoryData,GetHistoryDataByDate 方法取到的對象為共享模式;1為獨立模式,打開不同品種可以分別處理各自的數(shù)據(jù),數(shù)據(jù)處理完畢后要調(diào)用DestroyHistoryData方法銷毀內(nèi)存緩沖區(qū).
- 網(wǎng)友回復(fù):
明白了,還有一個問題,就是數(shù)組元素如何監(jiān)控?用application.msgout data(0)輸出顯示對象不支持