|
Setting the background color of a candle on a finance chart |
Posted by redblue on Mar-01-2017 04:57 |
|
Hi,
Is it possible to set the background color of a candle/bar on bar by bar basis like the chart in the attached image? I am using the C++ version.
Regards,
|
Re: Setting the background color of a candle on a finance chart |
Posted by Peter Kwan on Mar-02-2017 01:49 |
|
Hi redblue,
Yes. you can use Axis.addZone to add the background colors to the chart. See:
http://www.advsofteng.com/doc/cdcpp.htm#markzone2.htm
For your case, the key is to obtain the proper chart and axis to add the zone, and to use the proper x-coordinates. If you are using a FinanceChart, and would like to add the zone to the main price chart, then you need to use the XYChart object representing the main price chart, which is returned when you called FinanecChart.addMainChart, like:
XYChart *myMainChart = myFinanceChart->addMainChart(..........);
Then you can add the zone to the x-axis. The x-coordinate will be the visible trading session number. The position of the first visible candlestick is x = 0. The position of the second visible candlestick is x = 1, etc.. If you want the boundary of the zones to be in between two candlesticks, you can use fractional x coordinates.
Hope this can help.
Regards,
Peter Kwan |
|