|
Set text at a date of timestamp in Finnance chart? |
Posted by Tuyen on May-08-2012 15:27 |
|
How can I:
1. Add text at a date of timestamp in finnance chart?
2. I have 2 data: timestamp1(m), closeData1(m) and timestamp2(n), closeData2(n) and timestamp1(0)=timestamp2(0) and timestamp1(m)=timestamp2(n). How can I draw closeData1(m) and closeData2(n) into a chart with X axis label is timestamp1 or timestamp2?
Best Regards
Tuyen |
Re: Set text at a date of timestamp in Finnance chart? |
Posted by Peter Kwan on May-09-2012 01:47 |
|
Hi Tuyen,
1. It depends on where you would like to add the text to. You may use Layer.addCustomDataLabel to add text to a certain data point on the chart. You may even add a scatter layer to highlight the point and then add the text. You may use Axis.addMark to add text to certain position on the axis. Note that for a FinanceChart, the x-coordinate is the visible trading session (the first session is 0, the second session is 1, and so on.)
2. It depends on what you mean by "finance chart". In a standard "finance chart", you can only plot two series if they have exactly the same timestamps.
For example, suppose the first series has the timestamps for Apr 2012 at days 1, 4, 5, 6, 8, 9, 12. Note that some days are missing because they are non-trading days (like Sat, Sun in some countries, and Easter holidays, etc). In a finance chart, all data points should be equally spaced on the chart, even though the dates are not actually equally spaced due to holidays. It is because all financial indicators (such as RSI, moving average, etc.) requires equally spaced data points. In other words, the actual x-axis are not the dates, but are the trading sessions. The dates are for human reading only (just like names).
Suppose you have a second series with timestamps 1, 2, 3, 4, 5, 6, 9, 10, 12. Although the two timestamps have the same starting and ending dates, the dates in between are different. From the first series, the dates 1, 4, 5 should be equally spaced. But the second series require the dates 1, 2, 3, 4, 5 to be equally spaced (which means 1, 4, 5 are not equally spaced). Thus the two series are in contradition and cannot be plotted on the same finance chart.
If the two series do have the same timestamps, you can use FinanceChart.addComparision to add another closing price series for comparison.
If the two series use different timestamps, to plot both series, you may consider the following method:
(a) Change one or both series, so that they have the same timestamps. For example, you may insert dummy data points in one or both series, to make both of them to use the same trading days. For example, you may modify both series to make them use a trading calendar that always trade from Mon to Fri (that is, it assumes Sat and Sun are non-trading days and ignore public holidays such as Christmas, etc), or use a trading calendar based on the trading days of a particular country.
(b) Do not plot a standard "finance chart" (a chart that uses trading session as the x-axis and is consistent with financial indicators), but just plot a normal line chart. For example, see the "Uneven Data Points" sample code.
Hope this can help.
Regards
Peter Kwan |
Re: Set text at a date of timestamp in Finnance chart? |
Posted by Tuyen on May-14-2012 22:31 |
|
Thanks for your ideas.
With my question 2, I want draw timestamp1(m), closeData1(m) as a financhart(with my openData, highData,lowData), and use closeData2(n) for Comparision.
If n>m, how can I do it?
If can, please help me by code vb.net.
Thankyou very much.
Best Regards
Tuyen |
Re: Set text at a date of timestamp in Finnance chart? |
Posted by Peter Kwan on May-15-2012 05:18 |
|
Hi Tuyen,
As mentioned in my previous message, if it is a standard financial chart, the timestamps for the two data series must synchronize.
If n > m, this means one of the series has more trading days then the other series. In this case, please remove the data points from closeData2 until it matches with closeData1.
I am not sure which data points in closeData2 are the extra points. For example, assuming the points at the end of the arrays are extra, to remove them, use:
ReDim Preserve closeData2(Ubound(closeData1))
You may refer to VB documentation for more details.
Regards
Peter Kwan |
Re: Set text at a date of timestamp in Finnance chart? |
Posted by Tuyen on May-15-2012 22:18 |
|
Thank you very much. Because my data is difficult to compare and filter the data with the same date. But I will try.
Thanks for your comments.
Best Regards
Tuyen |
|