API Support Forum
User Profile

Viewing User Profile for: LMaher457


About

Mar 10, 2015 08:39 AM

Mar 16, 2015 03:12 PM

Mar 16, 2015 07:31 PM



Post Statistics
LMaher457 has contributed to 1 posts out of 5677 total posts (0.02%) in 3545 days (0.00 posts per day).

20 most recent posts:

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