1
votes

I am trying to plot some sample data I got from an excel file and saved into arrays in a candlestick chart. The data I am trying (if it helps) is a forex pair(EUR/GBP ratio), in forex, pairs are quoted at the 4 decimal point.

The problem is that the body of the candle is not visible on the chart as I would've expected in the below graph(image is just a random example). example candlestick chart

My candles plot like lines with barely any visible body.

my plotted candlestick chart

The Y axis minimum and maximum values are set by default to 0 and 1 so logically I assumed that the interval is the problem.(my sample data is around 0.8500 min and 0.9500 max) so naturally in order to see the candle body I tried to reduce the minimum and maximum interval in order to see any candle body, but this only caused my chart to plot blank, nothing there. blank candle chart

Just to test things around i'm plotting 15 points.

To plot those 15 point

              if (i < 15)
               {
                    chart1.Series["Series1"].Points.AddXY(i, 0, 0, Open[i], Close[i]);

                }

The plotting function takes 5 arguments, arg1 date, arg2 candle low, arg3 candle high, arg4 candle open price, arg5 candle close price.

If I had two candles with close prices of 0.8532 and 0.8539 and open prices 0.8530 and 0.8537 respectively I should've seen candle bodies like this Expcted candle body

The only thing I tried to play around with was with Y minimum and maximum values but with no solution, and with the Y axis scaleview property again with no solution again.

The last thing I can think of is to make the chart to take into account the 4 decimal point as a main value for which it plots it's data (I don't know how to make sense of this), going with significance from right to left If this makes sense.

Is there something that I miss?

What can I do to properly see the body of the candle?

And why when I reduce the Y axis value interval my charts gets blank.

Thanks in advance, any suggestion would be helpful.

1
Did you try to set a low and high value? With them being 0 where should a body come from? Those open/close values btw are pretty close so there is not much of a difference. Do play some more with you values! - TaW
Yes I tried to set a low value of 0.7500 and a high value of 0.9500 this makes my chart go blank. initially they were set by default to 0 and 1 and plot like lines. In forex the 4 decimal point makes quite a difference in candle body, a difference of 0.0009 is like a 9 in a 0-10 scale. I hope this makes sense. - Marian
In forex the 4 decimal point makes quite a difference in candle body, Huh? Your y-values go from 0 to 1, so, no, 0.0001 makes no visible difference ! You should at least use a plausible value for high and low, not 0 or else the rang will always be so off. You could use the same at open & close, maybe..: AddXY(i, Open[i], Close[i], Open[i], Close[i]) - TaW

1 Answers

0
votes

It all comes down to the numbers in your data.

The automatic axes scaling will allow for all values to show.

With high/low being 0/0 or 0/1 the range it needs to show goes from 0 to 0.8539 or from 0 to 1.

But the body only goes from 0.8530 to 0.8532.

So the body is ca 2/1000 of the axis range. To make it show you would need a rather large chart height.

Make sure to set suitable values in your data and help the chart along by setting the Minimum/Maximum values..:

var ca = chart1.ChartAreas[0];
ca.AxisY.Minimum = 0.8500;
ca.AxisY.Maximum = 0.8570;

chart1.Series["Series1"].Points.Clear();
chart1.Series["Series1"].Points.AddXY(2, 0.8532, 0.8530, 0.8532, 0.8530);

Result:

enter image description here