Announcement

Collapse
No announcement yet.

Trying Out TsSample(VB) - minor problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Trying Out TsSample(VB) - minor problem

    Trying Out TsSample(VB) - minor problem

    we are trying to collect Current T&Sales data...

    We are using VB6 only - we do not use VB.net
    Refs Include:......
    Visual Basic for Applicaitons
    Visual Basic Runtime Objects and Procedures
    Visual Basic Objects and Procedures
    OLE Automation
    IESignal
    We have put in the correct username
    we put in the IEsignal ref and code compiles and form shows just fine.
    We put in MSFT in symbol area and click start and code starts to run and then we get a runtime break in Sub FillTS line 11 of that Sub ...

    item = esignal.GetTimeSalesBar(lTsHandle, lBar)

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

    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 = edtSymbol.Text
    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

    lTsHandle = esignal.RequestTimeSales(tsFilter)

    End Sub
    Private Sub Form_Load()
    Set esignal = New IESignal.Hooks
    lTsHandle = 0
    lLastTsCount = 0
    esignal.SetApplication ("username")
    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, lNumRtBars, lBar, lDiff As Long
    Dim item As IESignal.TimeSalesData

    ' 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
    item = esignal.GetTimeSalesBar(lTsHandle, lBar) **BREAKS
    sBar = FormatTS(item)
    list.AddItem sBar, 0
    Next lBar

    lLastTsRtCount = lNumRtBars

    End Sub
    **Have Stop - Will Trade**

  • #2
    I copied your code into a VB 6 environment and the function works as expected. I am not completely clear on the logic of how you are determining the bar you are requesting, but I have verified that the function works exactly as it should.

    I attached the form I used.
    Attached Files

    Comment


    • #3
      Still Having Same Problem

      We were able to compile your eMail sample in VB6 and ran it and the code breaks on the same line as before

      We are using eSignal.exe version 7.6 R3

      Same Project Refs as first post
      **Have Stop - Will Trade**

      Comment


      • #4
        Again, this function works fine. There may be something wrong with your desktop configuration. Please completely uninstall eSignal, delete the installation directory, and install our newest version, located here

        Comment

        Working...
        X