Announcement

Collapse
No announcement yet.

TimeSales yielding zeros

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

  • TimeSales yielding zeros

    I tried to copy the code out of the book and all I get is lots of bars with 12AM for the time and zeros for everyting else. Is there a scope/timing issue with my esignal variables. Seems strange that you don't do a set after demensioning the variable.

    Private Sub cmdBrut_Click()
    Dim oFilter As IESignal.TimeSalesFilter
    With oFilter
    .sSymbol = "DELL"
    .bQuotes = True
    .bTrades = True
    .lNumDays = 1
    .bFilterPrice = False
    .bFilterVolume = False
    .bFilterQuoteExchanges = False
    .bFilterTradeExchanges = False
    End With
    mbBrutMode = True
    mlBrutHandle = moEsig.RequestTimeSales(oFilter)
    Me.txtResults = Me.txtResults & vbLf & "Init. Handle=" & CStr(mlBrutHandle)
    mlBrutCount = 0
    End Sub

    Private Sub moEsig_OnTimeSalesChanged(ByVal lHandle As Long)
    If mbBrutMode = True Then
    mlBrutCount = mlBrutCount + 1
    Me.txtResults = Me.txtResults & vbLf & "Brut Count=" & CStr(mlBrutCount) & " Handle=" & CStr(lHandle)
    End If
    HandleTimeSales lHandle
    End Sub

    Private Sub HandleTimeSales(ByVal lHandle As Long)
    'mlHandleList to be implemented later
    Dim oData As IESignal.TimeSalesData
    Dim lNumBars As Long
    Dim lBar As Long
    Dim lDiff As Long
    Dim lk As Long
    Dim sLine As String
    Dim sResults() As String
    Const iLimit As Integer = 10 'temporary for debugging
    lNumBars = moEsig.GetNumTimeSalesBars(lHandle)
    Me.txtBarCount = Format(lNumBars, "#,##0")
    If lNumBars > 0 Then
    ReDim sResults(1 To lNumBars)
    For lk = 1 To lNumBars
    oData = moEsig.GetTimeSalesBar(lHandle, lk)
    With oData
    sLine = CStr(.DataType) & vbTab
    sLine = sLine & CStr(.dtTime) & vbTab
    sLine = sLine & CStr(.dPrice) & vbTab
    sLine = sLine & CStr(.lSize) & vbTab
    sLine = sLine & CStr(.sExchange) & vbTab
    sLine = sLine & CStr(.lFlags)
    End With
    sResults(lk) = sLine
    If lk < iLimit Then
    Me.txtResults = Me.txtResults & vbLf & sLine
    End If
    Next lk
    End If
    End Sub

  • #2
    Hi Cone Killer,

    I am working in C++ and my understanding of VB is "sub-basic".
    However, since the 'TimesSalesData' data structures defaults to 12AM and to zeros in C++, chances are it exhibits the same behavior in VB.
    My analysis would be that there is no "scope/timing issue", but that somehow you miss to get the values into your variables, or you don't access them properly later on.
    If you say that you were copying the "code out of the book", I'm not sure which book you are talking about. My version shows code that is quite different from yours (cf p 4-9). I suggest if you copy this code, then rework it slowly to what you intend to do in your own application, this transition is guaranteed to give you positive results.
    Make sure you use an active instrument, in an open session, that you do get bars, and that you index those bars correctly, both when transferring data from the feed into your 'TimeSalesData' instances, and when you access those later on.
    Good luck.

    Comment


    • #3
      Roland,
      Thank you for taking the time to give me a few hints. It is helpful to know that I am reading default values so I can stop playing around with scope and perhaps timing alternatives. The bars appear to be arriving in reasonable quantity and frequency so that makes sense. I must be doing some little, stupid thing somewhere -- for which I will kick myself later.

      Sorry for the verbose VB code -- this test code is just displaying the raw numbers on a form so I can see what I am getting (or not) before putting the code in the application.

      Cone Killer

      Comment


      • #4
        Try changing this line:

        oData = moEsig.GetTimeSalesBar(lHandle, lk)

        to this:

        oData = moEsig.GetTimeSalesBar(lHandle, -(lk - 1))

        Cheers... George

        BTW, are you an autocrosser?

        Comment


        • #5
          George,

          You are my hero! I was beginning to suspect that section of code but it would have been some time before I thought of trying negative numbers. The base change makes sense -- but negative numbers?

          Yes, I support the tire industry whenever I get a chance.

          Regards,
          Cone Killer

          Comment


          • #6
            Yeah. I agree it takes a little getting used to the using negative numbers. It goes against the grain so to speak for most programmers, but it is the way eSignal (as well as some other non-eSignal charting apps) reference their bars. The rational is that zero is right now and to get a past event you have to go back in time (flow time negatively you might say).

            I have yet to autox, but I have hit a few road tracks. Might just have to try autox one of these days.

            Cheers... George

            Comment


            • #7
              Going through a graphic API to get time stamped raw data is a bit of a hack anyway -- but if it works, what the heck?

              A roadracer, like yourself, might find autocross a bit underwhelming but my wife and I enjoy both the cars and the people here in the bay area. If you are a local, look out for a low flying "arrest me" red boxster.

              Regards,
              Cone Killer

              Comment


              • #8
                The speeds are a bit lower, but still plenty of skills to learn in autox. No doubt challenging, and safer. The question I have to ask myself when going 120+ down the straights and late breaking into the turn, to paraphrase Mr. Eastwood, is do I feel lucky? Last time I was at the track, a Miata was completely obliterated and the driver had to be air-lifted still unconcious.

                I'm on the opposite coast, BTW.

                Cheers... George

                Comment

                Working...
                X