And not sure why you'd need to store all the values of the bars on the first pass anyway -- they are all the same width. Sounds like Premature Optimization.
for each bar, there are four x,y coordinates (x1,x2,y1,y2) and you might have noticed that there are two threads/sticks attached with each candlestick bar, for those you need more 2x2=4 coordinates. Although bars are of same width but not of same height. So there will be total 8 coordinates for each bar. Additionally if you want border around each bar, there will be atleast 4 coordinates more.
You're building images in memory and worring about an array of integers?!?
Yes I am worried, because I have a shared hosting in which almost all pages are dynamic. It scraps pages from a stock market website and shows in a simpler format. Thus it creates a heavy load on shared server. Few days ago, I was bound to restrict some of my pages by login system as my site was suspending for using over-resources (only 15% CPU usage). So I try to use as much simpler code as I can. I even don't use more than two/three include files in one page to reduce http requests per page.
My intention was to ask you whether there was any way to draw the bars and curves first and then polygon in sequence by using some types of mask/transparency for this reason.
Wishing a help still from you.