What are the values used for candlesticks

This sounds like an easy question but I googled for hours and could not find any info on this.

What is the value used for the open of a candlestick ? Was that value a market sell or a market buy ?
Vice versa what value is used for the close ? Is it the last market sell or market buy ?

I have a data set with market orders and I am trying to create candlesticks out of that data.