We develop further an approach to computing energy-energy correlations (EEC) directly from finite correlation functions. In this way, one completely avoids infrared divergences. In maximally supersymmetric Yang-Mills theory ($mathcal{N}=4$ sYM), we derive a new, extremely simple formula relating the EEC to a triple discontinuity of a four-point correlation function. We use this formula to compute the EEC in $mathcal{N}=4$ sYM at next-to-next-to-leading order in perturbation theory. Our result is given by a two-fold integral representation that is straightforwardly evaluated numerically. We find that some of the integration kernels are equivalent to those appearing in sunrise Feynman integrals, which evaluate to elliptic functions. Finally, we use the new formula to provide the expansion of the EEC in the back-to-back and collinear limits.