|
謝謝Alex大大回復:
1.該程式經測試,並無法累加計算出成交均價,想要計算該值最主要是認為成交均價在短線當沖上,可以當作進出場的依據,當成交價格跌破均價時,可以考慮進場放空,突破時可以進場作空,如下圖群益的台指分時走勢圖
2.另外我修改了一下程式,如excel副檔,但是還時無法計算出想要的成交均價,不知Alex大大可否幫忙看一下,提供修改意見
Private Sub skQ_OnNotifyHistoryTicks(ByVal sMarketNo As Integer, ByVal sStockIdx As Integer, ByVal nPtr As Long, ByVal nTimehms As Long, ByVal nTimemillismicros As Long, ByVal nBid As Long, ByVal nAsk As Long, ByVal nClose As Long, ByVal nQty As Long, ByVal nSimulate As Long)
Dim rng As Range
Dim yen1 As Long
Dim yen2 As Long
Dim yen3 As Long
yen1 = 0
yen2 = 0
[m2:t2].ClearContents
For Each rng In [p2:p2]
If nTimehms >= 84500 & nTimehms <= 134500 Then
yen1 = yen1 + nClose * nQty / 100
yen2 = yen2 + nQty
yen3 = yen1 / yen2
Sheet1.[m2] = nTimehms
Sheet1.[n2] = nBid / 100
Sheet1.[o2] = nAsk / 100
Sheet1.[p2] = nClose / 100
Sheet1.[q2] = nQty
Sheet1.[r2] = yen1
Sheet1.[s2] = yen2
Sheet1.[t2] = yen3
End If
Next
End Sub
|
|