Run Time Error... -2147023898(800703e6)

C

Chris James

Getting a runtime code break and cannot work out why?

In Sub FILLTS - Line 15 i get the run time break...

Run-Time error '-2147023898(800703e6)
Method of 'GetTimeSalesBar' of object 'IHooks' failed

******************************************************

Option Compare Database
Option Explicit

Dim WithEvents esignal As IESignal.Hooks
Dim sLastSymbol As String
Dim lTsHandle As Long
Dim lLastTsCount As Long
Dim lLastTsRtCount As Long
Private Sub ReleaseTS()
If lTsHandle <> 0 Then
esignal.ReleaseTimeSales lTsHandle
lTsHandle = 0
lLastTsCount = 0
End If
End Sub

Private Sub cmdRelease_Click()
ReleaseTS
End Sub

Private Sub cmdRequest_Click()
Dim sSymbol As String

sSymbol = Me.edtSymbol
Trim (sSymbol)

If sSymbol = "" Then
Exit Sub
End If

ReleaseTS

Dim tsFilter As IESignal.TimeSalesFilter
tsFilter.sSymbol = sSymbol
tsFilter.bQuotes = True
tsFilter.bTrades = True
tsFilter.lNumDays = 1
tsFilter.bFilterPrice = False
tsFilter.bFilterVolume = False
tsFilter.bFilterQuoteExchanges = False
tsFilter.bFilterTradeExchanges = False

'list.Clear
Me.list = ""
Me.list = Null

lTsHandle = esignal.RequestTimeSales(tsFilter)

End Sub
Private Sub Form_Load()
Set esignal = New IESignal.Hooks
lTsHandle = 0
lLastTsCount = 0
esignal.SetApplication ("userMe")
End Sub
Private Sub Form_Unload(Cancel As Integer)
ReleaseTS
Set esignal = Nothing
End Sub

Private Sub esignal_OnTimeSalesChanged(ByVal lHandle As
Long)
FillTS
End Sub

Private Function FormatTS(item As TimeSalesData)
Dim sRet As String

If item.DataType = tsdNA Then
sRet = "NA"
Else
sRet = Str$(item.dtTime)

If item.DataType = tsdTRADE Then
sRet = sRet + ", Trade"
ElseIf item.DataType = tsdBID Then
sRet = sRet + ", Bid"
ElseIf item.DataType = tsdASK Then
sRet = sRet + ", Ask"
End If

sRet = sRet + ", " + Str$(item.dPrice)
sRet = sRet + ", " + Str$(item.lSize)
sRet = sRet + ", " + item.sExchange
End If

FormatTS = sRet

End Function
Private Sub FillTS()
Dim lNumBars As Long, lNumRtBars As Long, lBar As Long,
lDiff As Long, item As IESignal.TimeSalesData, sBar As
String

lLastTsRtCount = 0

' only showing realtime bars.
lNumRtBars = esignal.GetNumTimeSalesRtBars(lTsHandle)
lNumBars = esignal.GetNumTimeSalesBars(lTsHandle)

' how many new bars since last time?
lDiff = (lNumRtBars - lLastTsRtCount) * -1

For lBar = lDiff + 1 To 0
'BREAKS ON THE LINE BELOW
item = esignal.GetTimeSalesBar(lTsHandle, lBar)
sBar = FormatTS(item)
list.AddItem sBar, 0
Next lBar

lLastTsRtCount = lNumRtBars

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top