QCustomPlot Discussion and Comments

whether QCP can plot Stock Chart (OHLC or CandelStick)?Return to overview

whether QCP can plot Stock Chart (OHLC or CandelStick)?

I would be interested in that answer too.

I'd really like to know this as well

Me too!

The current version doesn't have a built-in plottable for OHLC, though it is planned.

Just OHLC will be added or we can have CandelStick charts as well and can I ask when we can expect new version which includes such charts

Candlestick will be included as well. There is no release date fixed for version 1.3 yet.

until then and for now I am using the following function call to draw candlesticks it's not bad and acceptable for me, it may be also usable for the others for now.

void DrawCandles(QCustomPlot *cp,int i)
{
double dClosePrice=iList.at(i).at(4);
double dHigh=iList.at(i).at(2);
double dLow=iList.at(i).at(3);
double dOpenPrice=iList.at(i).at(1);
QBrush boxBrush;
QCPStatisticalBox *p = new QCPStatisticalBox(cp->xAxis, cp->yAxis);
cp->addPlottable(p);
if(dOpenPrice>dClosePrice) boxBrush.setColor(Qt::black);
else boxBrush.setColor(Qt::white);
boxBrush.setStyle(Qt::SolidPattern);
p->setBrush(boxBrush);
p->setKey(i);
p->setMinimum(dLow);
p->setLowerQuartile((dClosePrice<dOpenPrice) ? dClosePrice:dOpenPrice);
p->setMedian(dClosePrice);
p->setUpperQuartile((dClosePrice>dOpenPrice) ? dClosePrice:dOpenPrice);
p->setMaximum(dHigh);
}