ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Processing “out of order” DateTime intervals
Posted by Chuck on Jan-17-2020 08:49

Hello Peter,

On a ChartDirector OHLC financial chart where the X-Axis is formatted as DateTime and every bar is the exact same interval (let’s say 15 minutes) and the Y-Axis is Price with a Timestamp included with the OHLC data for each interval.... what would need to be configured in ChartDirector (a VB.NET example would be awesome) such that OHLC data can we written out of sequential (DateTime) order, yet would appear correctly on the chart (because the X-Axis is formatted as DateTime and the DateTime is passed with the OHLC data).

Here’s why... my **multi-threaded system* starts by fetching Historical OHLC data for every DateTime interval back 500 Bars as a startup request...

... while this data is being fetched, (let’s say) a new 15m Bar closes and (in a separate thread) updates the system...

Is there a way to configure the X-Axis (as DateTime) such that when the above occurs (data loading out of sequential DateTime order) that the data will always appear at the correct position on the X-Axis correctly?

(If for some reason the above is not clear, the scope of the question infers the following...)

Bars -500, -499, -498...-250, 0, -249...-1 load in the following order...
yet it is desired that the chart appear correctly as...
Bars -500, -499, -498...-250, -249...-1, 0...
Where Bar# is a specific historical DateTime interval.

Thank you for your help.
Chuck

  Re: Processing “out of order” DateTime intervals
Posted by Peter Kwan on Jan-17-2020 15:57
Hi Chuck,

ChartDirector will only plot the chart in the same order of your data. For your case, you may sort your data based on the timeStamp before passing the data to ChartDirector.

If I were you, I may just use two arrays, one for the historical data, one for the realtime data, then combine them into one array before passing the data to ChartDirector. In your method, the arrays are accessed by two threads, so it needs to be locked for every read/write access, which incurs overhead. With two arrays, there each array is only accessed by one thread, so no locking is needed. By the time you combine the arrays, the historical data has already been loaded, and only one thread is using the arrays, and again no locking in needed.

Regards
Peter Kwan

  Re: Processing “out of order” DateTime intervals
Posted by Chuck on Jan-18-2020 00:22
Thank you Peter.