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

Message ListMessage List     Post MessagePost Message

  Financial Chart HLC
Posted by Miguel on Mar-23-2006 05:08
Dear Sirs,

Is it possible to use the financial charts with only HLC?

  Re: Financial Chart HLC
Posted by Peter Kwan on Mar-23-2006 05:20
Hi Miguel,

If you are creating financial charts using addHLOCLayer API, you may just leave out the OpenData argument (by using an empty array). The chart will then contain only HLC.

Regards
Peter Kwan

  Re: Financial Chart HLC
Posted by Dennis on Dec-12-2010 17:30
Hi Peter,

1. I have the similar issue - I need to get HLC bars. But also I need cd.HLOCOpenClose coloring method (so I use addHLOCLayer3). My problem is that with empty open array I get all the bars drawn with one color...

I also have tried to use the following code:
layer = chart.addHLOCLayer3(aHighData, aLowData, aOpenData, aCloseData, iUpColor, iDownColor, cd.HLOCOpenClose);
layer.getDataSet(2).setDataColor(cd.Transparent);

But this code didn't produced the expected result.


2. The second issue with HLC bars is that I want every bar to have width of 2px (1px for high-low line and 1px for close mark). But if I use

layer.setDataWidth(2);

it seems to "cut" close marks, so I get only high-low lines (or OHL bars if I specify non-empty open array)


I hope you can help me...

  Re: Financial Chart HLC
Posted by Peter Kwan on Dec-13-2010 12:54
Hi Dennis,

1. The cd.HLOCOpenClose coloring method means to color the OHLC symbol based on whether the opening price is higher or lower than the closing price of the same day.

If you do not supply the opening price, it does not seem to be possible for ChartDirector (or for anyone else) to determine if the opening price is higher than the closing price. Would you mind to clarify how you would like the the bars to be colored? Do you really mean the cd.HLOCUpDown coloring method?

2. You would need to set the bar width to 3 pixels. Even if you are not plotting the opening mark, it still consume a pixel. If you set the bar width to 3 pixels, the open and close mark will each consume 1 pixel, and the center vertical line 1 pixel.

Note that setting the bar width will not affect the bar spacing. If your plot area is 500 pixels wide and you have 100 bars, the bars will be 5 pixels apart, no matter what is the bar width. So setting the bar width to 3 pixels will not change the layout of your chart.

Hope this can help.

Regards
Peter Kwan

  Re: Financial Chart HLC
Posted by Dennis on Dec-13-2010 14:11
Hi Peter,

Peter Kwan wrote:

The cd.HLOCOpenClose coloring method means to color the OHLC symbol based on whether the opening price is higher or lower than the closing price of the same day.

If you do not supply the opening price, it does not seem to be possible for ChartDirector (or for anyone else) to determine if the opening price is higher than the closing price. Would you mind to clarify how you would like the the bars to be colored? Do you really mean the cd.HLOCUpDown coloring method?

I really meant cd.HLOCOpenClose coloring method. I have an Opening price data, but I don't have to display an open mark on the bar (so, I can provide this data to ChartDirector, but I'm looking for a way in which I can hide an open mark). Is it possible in any way?

Regards
Dennis

  Re: Financial Chart HLC
Posted by Peter Kwan on Dec-14-2010 02:05
Hi Denni,

To achieve what you need, you may need to use two layers, each for one color.

I am not too sure what is your programming language (is it ColdFusion or Javascript or something else), so I will use ColdFusion as an example:

//compare open with close
selector = cd.ArrayMath(openData).subtract(closeData).result();

//for open>=close
c.addHLOCLayer(cd.ArrayMath(highData).selectGEZ(selector, cd.NoValue).result(), cd.ArrayMath(lowData).selectGEZ(selector, cd.NoValue).result(), ArrayNew(1), cd.ArrayMath(closeData).selectGEZ(selector, cd.NoValue).result(), "0xff0000");

//for open < close
c.addHLOCLayer(cd.ArrayMath(highData).selectLTZ(selector, cd.NoValue).result(), cd.ArrayMath(lowData).selectLTZ(selector, cd.NoValue).result(), ArrayNew(1), cd.ArrayMath(closeData).selectLTZ(selector, cd.NoValue).result(), "0x008000");

Hope this can help.

Regards
Peter Kwan

  Re: Financial Chart HLC
Posted by Dennis on Dec-14-2010 16:56
Hi Peter,

Thank you for your help! Your solution is great and it works fine for me!

Regards
Dennis