First-, second- and third-order correlation function in time-resolved X-ray diffraction experiments