Announcement

Collapse
No announcement yet.

intraday bar updates

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

  • intraday bar updates

    After making a request say for minute bars over a time range I thought I could use the OnBarsChanged to update the current bar and get new bars as time moves forward. But what I see is when OnBarsChanged is called is that it does not advance and keeps reporting the same old bars and does not report any bars past the time of my initial request for bars So my chart stops updating to the latest bar and does not advance... What am I doing wrong? Also why does OnBarsChange report more than one bar has changed when this is not the case?

    For example if I make a request for one minute bars from say 9am to 10am at 10am, after I get the bars I see OnBarsChanged calls with bars from 9:45 to 10:00 as it updates the 10:00 bar... but then at 10:01 and later it just keeps calling OnBarsChanged with the bars from 9:45 to 10:00 which of course are not changing.... what I would like to see is... at 10:00, OnBarsChanged called with just the 10:00 bar as it updates and then at 10:01, just the 10:01 bar as it updates, etc... Is this possible?

  • #2
    For handling bar received and bar updates, please take a look at the function below. Note that it does keep track of how many bars were received in the past update. The middle case should be able to take care of what you want.

    Private Sub FillHistory()
    ' This function handles all bars received and bar updates
    Dim lNumBars As Long
    Dim baritem As IESignal.BarData
    Dim lBar As Long
    Dim sBar As String

    lNumBars = esignal.GetNumBars(lHistoryHandle)
    If lNumBars = 0 Then
    Exit Sub
    End If

    If lstHistory.ListCount > 0 And lNumBars = lLastHistoryCount Then
    ' Update the top bar
    baritem = esignal.GetBar(lHistoryHandle, 0)
    sBar = FormatBarData(0, baritem)

    lstHistory.List(0) = sBar
    ElseIf lstHistory.ListCount > 0 And lNumBars = lLastHistoryCount + 1 Then
    ' Add a new bar
    baritem = esignal.GetBar(lHistoryHandle, 0)
    sBar = FormatBarData(0, baritem)
    lstHistory.AddItem sBar, 0
    ElseIf lstHistory.ListCount = 0 Or lNumBars <> lLastHistoryCount + 1 Then
    ' Refresh entire list box
    For lBar = -(lNumBars - 1) To 0
    baritem = esignal.GetBar(lHistoryHandle, lBar)
    sBar = FormatBarData(lBar, baritem)
    lstHistory.AddItem sBar, 0
    Next lBar

    End If

    lLastHistoryCount = lNumBars
    End Sub

    Anthony

    Comment


    • #3
      i minute bar updates

      After requesting the one minute bars, I get the update callbacks, however after a minute or two, the number of bars no longer increases with each minute. I am using eSignal Data Manager Version 7.9 (Build 291) with XP professional.

      Comment

      Working...
      X