Next: , Previous: , Up: 1D samples   [Contents][Index]

3.5.14 OHLC sample

Function ohlc draw Open-High-Low-Close diagram. This diagram show vertical line for between maximal(high) and minimal(low) values, as well as horizontal lines before/after vertical line for initial(open)/final(close) values of some process. The sample code is:

int sample(mglGraph *gr)
  mglData o(10), h(10), l(10), c(10);
  gr->Fill(o,"0.5*sin(pi*x)");  gr->Fill(c,"0.5*sin(pi*(x+2/9))");
  gr->Fill(l,"0.3*rnd-0.8");    gr->Fill(h,"0.3*rnd+0.5");
  gr->SubPlot(1,1,0,"");  gr->Title("OHLC plot");
  gr->Box();  gr->OHLC(o,h,l,c);
  return 0;

Example of OHLC()