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

Message ListMessage List     Post MessagePost Message

  Draw line off price ticks (finance chart)
Posted by icm63 on Dec-17-2011 15:35
Attachments:
Finance chart  - bar chart

Can I draw a line layer as in the image. If I draw stand line the numbers are spread on the date tick and NOT on the in between ticks as shown, how can I draw a line (linelayer) like this?
barchart.jpg

  Re: Draw line off price ticks (finance chart)
Posted by Peter Kwan on Dec-20-2011 06:09
Hi icm63,

To draw a line in between the ticks, please use an x-coordinate that is in between the ticks. For example, to draw in between the 26th and 27th tick, please use x = 25.5.

Hope this can help.

Regards
Peter Kwan

  Re: Draw line off price ticks (finance chart)
Posted by icm63 on Dec-20-2011 14:04
Is you instruction for a Finance chart ( as per finance code demo that comes with dll) or for the XY chart??

Because I am using a finance chart, and x axis is populates with DIM Period() datetime, as per add dataset OHLC etc

So please expland..

  Re: Draw line off price ticks (finance chart)
Posted by icm63 on Dec-20-2011 14:05
I mean expand..

  Re: Draw line off price ticks (finance chart)
Posted by Peter Kwan on Dec-21-2011 01:00
Hi icm63,

For the type of chart you want, you would need to add it to the main price chart in the FinanceChart object. The main price chart is an XYChart, obtained as the returned value of FinanceChart.addMainChart.

Like all label based axis, in the FinanceChart, the x-coordinates are 0, 1, 2, .... representing the first, second, third, .... label positions. So if you would like to draw in between the 26th and 27th tick, you may use x = 25.5. If you have a date, the tick position of that date is equal to the array index of that date, minus any extraPoints you use (the last parameter to FinanceChart.setData).

Hope this can help.

Regards
Peter Kwan

  Re: Draw line off price ticks (finance chart)
Posted by icm63 on Dec-21-2011 12:31
Attachments:
I see, the chart is a little more tricky

x1 has two y points, y1 and y2

x2 has one y point, y3

x3 has two y points, y4 and y5

Any ideas how I populate a array with x,y points like this..
barchart2.jpg

  Re: Draw line off price ticks (finance chart)
Posted by Peter Kwan on Dec-22-2011 03:09
Hi icm63,

According to your message, you have 5 points, which are:

(x1, y1)
(x1, y2)
(x2, y3)
(x3, y4)
(x3, y5)

So you may just populate your arrays using the above 5 points. The x array is (x1, x1, x2, x3, x3) and the y array is (y1, y2, y3, y4, y5).

Hope this can help.

Regards
Peter Kwan

  Re: Draw line off price ticks (finance chart)
Posted by icm63 on Dec-22-2011 15:10
So an LineLayer input double() will draw with this type of x? and y? co ordinates then ?

  Re: Draw line off price ticks (finance chart)
Posted by Peter Kwan on Dec-23-2011 01:34
Hi icm63,

Yes. The LineLayer does not restrict the direction of your lines. You can have vertical segments or even segments that flow "backwards" (from right to left). You just need to pass the data points to ChartDirector, and ChartDirector will join them with straight lines.

The XYChart.addLineLayer accepts a double array as the y-coordinates. You may pass the x-coordinates using Layer.setXData.

Hope this can help.

Regards
Peter Kwan

  Re: Draw line off price ticks (finance chart)
Posted by icm63 on Dec-23-2011 01:36
great, will give it ago. Love this product, have a good xmas !

  Re: Draw line off price ticks (finance chart)
Posted by icm63 on Jan-04-2012 12:48
Attachments:
Finance Chart with an XYChart


Ok this is where I am at:

SPY1 chart:  has 574 data points, 475 are extra points, 119 are visible (or drawn)

moving on....

Data.txt: I have created the data array with one for X points and one for Y points the out put you see is for this code:


For vv As Integer = 0 To VolumeWaveTLineY.GetUpperBound(0)
   Util.zPFile(vv & " / " & VolumeWaveTLineX(vv) & " / " & VolumeWaveTLineY(vv))
Next

The data shows some double X's of the same value for different y values. Tis is how I get the square approach with the lines (see next chart)


moving on...


SPY2 Chart: Is the drawing from this code:

Dim TLine As LineLayer = c.addLineLayer(VolumeWaveTLineY, adjColorWaveline, "TL")
TLine.setXData(VolumeWaveTLineX)

The SPY2 draws the  CORRECT BLUE LINE shape, BUT NOT over the price bars as required, why does it draw very far to the right. Strange !

I created a linelayer for the chart, rather than doing it with heaps of trendlines.

What have I done wrong.  Any ideas...
SPY1.jpg
SPY1.jpg

32.50 Kb
SPY2.jpg
SPY2.jpg

35.49 Kb
Data.txt
Data.txt

23.79 Kb

  Re: Draw line off price ticks (finance chart)
Posted by Peter Kwan on Jan-05-2012 01:43
Hi icm63,

For your case, the array VolumeWaveTLineY should be of the same length of your other data arrays (the same length as highData, lowData, openData, closeData, timeStamps, etc). You code just need to put the position of the point on each trading session in the array. There is no need to use VolumeWaveTLineX. That means the line "TLine.setXData(VolumeWaveTLineX)" can be removed, and the VolumeWaveTLineY should be modified so that it is of the same length as your other data arrays.

If you must use x-coordinates (which is not common in financial charts), the x-coordinates should be the visible trading session, which is the array index of your normal data (eg. the array index of timeStamps), minus the extra points.

Hope this can help.

Regards
Peter Kwan

  Re: Draw line off price ticks (finance chart)
Posted by icm63 on Jan-05-2012 03:17
BUT YOU SAID THIS ABOVE...

..."

(x1, y1)
(x1, y2)
(x2, y3)
(x3, y4)
(x3, y5)

So you may just populate your arrays using the above 5 points. The x array is (x1, x1, x2, x3, x3) and the y array is (y1, y2, y3, y4, y5).

"...


The above has X1 with Y1 and Y2 (thats an x with two ys), this is how I get the vertical line within the line series. This means that array of ys cant be the same length as the data in the finance chart ( of open, high, low, close etc).

YOU said..."There is no need to use VolumeWaveTLineX. That means the line "TLine.setXData(VolumeWaveTLineX)" can be removed, and the VolumeWaveTLineY should be modified so that it is of the same length as your other data arrays."..

So if I do make VolumeWaveTLineY the same length how will it draw the vertical line above with x1 with y1 and y2, is this what you are saying?

  Re: Draw line off price ticks (finance chart)
Posted by icm63 on Jan-05-2012 04:28
Attachments:
This is the chart I get when I  match VolumeWaveTLineY to dataHigh.

VolumeWaveTLineY does not have two points (y) for a single X when the line turns.

This means I get sloped vertical lines, when I need vertical lines.

I need vertical lines.
SPY3.jpg

  Re: Draw line off price ticks (finance chart)
Posted by Peter Kwan on Jan-06-2012 01:06
Hi icm63,

Please use a StepLineLayer if you want a step line (use XYChart.addStepLineLayer).

You may also want to use StepLineLayer.setAlignment to configure where the "step" occurs. If you have a point at y = 10, and then the next point is y = 12, there must be a step to jump from y = 10 to y = 12. The step can occur at the x-position of the first point, or that of the second point, or in the middle between the two points.

Hope this can help.

Regards
Peter Kawan

  Re: Draw line off price ticks (finance chart)
Posted by icm63 on Jan-06-2012 04:13
Done, Thanks !