### Bookstore

 Computer Math and Games in Pascal (preview) Lazarus Handbook

### Author Topic: good style - many series weeky and daily  (Read 380 times)

#### Nicole

• Hero Member
• Posts: 597
##### good style - many series weeky and daily
« on: December 05, 2022, 05:12:12 pm »
Do you have hints for me how to handle series?

We have a TAChart with many series, most of them are weekly data.
Those are tidy from their being sync. All weekly-date-points come in at the same day of the week, line series.

Then I add some more data, a series: OHLC-daily.
They do not show up at all. And I suspect, this is due to the fact, that the data are daily.
May this be?

And to make the topic even more complex, the weekly start usually is NO Monday, but may be a Tuesday or Friday and sometimes there are no data for a week at all from those "weekly"- series. On this day, they are sync, but we do not know on which week-day.

In my dreams, the daily data shall just adjust OHLC to the weekly data of the other series.
And not only the values, but sense making OHLC-series values, which were between the weeky data-data-points.
Is this possible?

#### wp

• Hero Member
• Posts: 10462
##### Re: good style - many series weeky and daily
« Reply #1 on: December 05, 2022, 06:31:19 pm »
What is the x value of each data point? A date/time value? In this case the value (lineseries point or OHLC bar) is plotted at exactly this date. Isn't this what you want?

I am attaching a small demo plotting the share values of some company in the way I understand your request: Every work day has a value in the OHLC series, and on Monday (or the first day after a 2-day gap in the data) the average of the C values of the previous week is calculated (as an example) and added to the lineseries. A DateTimeIntervalChartSource is assigned to the x axis Marks.Source to convert the date numbers to a "nice" date string.

#### Nicole

• Hero Member
• Posts: 597
##### Re: good style - many series weeky and daily
« Reply #2 on: December 05, 2022, 07:50:03 pm »
It is something alike, but differently.

Yes, you are right, the x-axes is a date, - but then it gets tricky.

https://cotbase.com/on-cot/

COT figures are generated at Tuedays, published at Fridays and if the congress does not pay - for some weeks not at all. And sometimes late, because there is an US holiday. In other words: We have one figure a week at most, but nobody knows exactly when and not sure "if".

With this COT figures shall be displayed the cash-market. Cash markets may be generated from the USA or from Europe. So there may be one holiday at one continent and not at the other.

These cash-market is daily, not weekly.

Have a look, how it shall look. The example is taken from my old Delphi code, which worked with TChart Pro from Steema. Not sure any more, how I did it or how Steema did. Would not help me anyhow.

If we have open, high, low, close - it is important WHICH low. It shall be the lowest low of all days between the 2 weekly COT data. If is is the only solution, I would take the low of this date, - however, I am not too enthusiastic to do this.

#### wp

• Hero Member
• Posts: 10462
##### Re: good style - many series weeky and daily
« Reply #3 on: December 05, 2022, 09:28:37 pm »
I can't help you with COT figures, this is not my field of knowledge.

The OpenHighLowCloseSeries of TAChart is dumb. It does not know about "open"/"high"/"low"/"close", it only knows: draw a left-tick for the "open" value and a right-tick for the "close" value, and the "high" value is the upper, the "low" value the lower end of the bar. You can plot anything in this series, the only requirement is that you must provide four y values. And if you add the data by the AddXOHLC method you provide the y values in the correct order. It is your task to calculate the values correctly and in the way you need them.

It is absolutely no problem to mix a series with equidistant daily x values and a series with irregularly spaced x values within the same chart. Just use the correct data as x value when you add the data (AddXY in the lineseries, AddXOHLC in the OpenHighLowCloseSeries).
« Last Edit: December 05, 2022, 09:30:16 pm by wp »

#### Nicole

• Hero Member
• Posts: 597
##### Re: good style - many series weeky and daily
« Reply #4 on: December 06, 2022, 10:54:47 am »
Thank you for the hints.
The problem may be anywhere else as well. I will keep debugging.