What would be the order of the candles?

So the current candle is candle 0, the previous candle is 1, and the previous one is 2, and so on? I need to know this to program a bot.