Is this code in a standalone script or an extension? It must be in an extension, because you can not receive events (such as OnHistoryUpdated) in a standalone script, since it just runs and exits.
SO if you're in an extension, you create your own handler class such as
<code>
class MyEventHandler
public Function OnHistoryUpdated ( Ticker )
' do something here
End Function
end Class
</code>
and you register it with the application like this:
<code>
Dim handler
Set handler = new MyEventHandler
Set EventManager = Application.GetObject("EventManager")
If Not EventManager Is Nothing Then
EventManager.RegisterHandlerMethod handler, "OnHistoryUpdated"
Else
' error
End If
</code>
So when you call ticker.DownloadHistoryData later, PSM calls your OnHistoryUpdated function when the data is ready to be read, then you can read it and do whatever. You should never be calling OnHistoryUpdate function from your own code.
In the OnHistoryUpdate function, getting the HistoryStart and HistoryEnd properties won't do anything, because those do not indicate what data is available. You set those properties to tell the software what date range to retrieve. Right now I don't know if reading back those properties will give you the correct dates, since I haven't had a chance to test that. But it should.