Market Data » Does any one have a example of using the excel .com sample SubscribeBars? Mar 16, 2015 @ 03:12 PM (Total replies: 0) | |||||
This is as far as I got: Sub UpdateQuotes(newContract As OECAPICOM.contract) If Not (CurrentContract Is Nothing) Then api.UnsubscribeBars CurrentContract End If Set CurrentContract = newContract If Not (CurrentContract Is Nothing) Then api.SubscribeBars CurrentContract, TimeValue(Hour(Now) & ":" & Minute(Now) & ":00") - TimeSerial(2, 0, 0), 1 Dim i As Integer Dim Bars() As OECAPICOM.Bar Set Bars() = api.Subscriptions.?? Range("A16:D2895").ClearContents i = 16 For Each OECAPICOM.Bar In Bars Range("B" & i) = CurrentContract.StringToPrice(Bar.High) Range("C" & i) = CurrentContract.StringToPrice(Bar.Low) Range("D" & i) = CurrentContract.StringToPrice(Bar.Close) i = i + 1 Next Bar End If End Sub Leonard Maher |