  Direct imaging of exoplanets is usually limited by quasi-static speckles.
These uncorrected aberrations in a star's point spread function (PSF) obscure
faint companions and limit the sensitivity of high-contrast imaging
instruments. Most current approaches to processing differential imaging
sequences like angular differential imaging (ADI) and spectral differential
imaging (SDI) produce a self-calibrating dataset that are combined in a linear
least squares solution to minimize the noise. Due to temporal and chromatic
evolution of a telescope's PSF, the best correlated reference images are
usually the most contaminated by the planet, leading to self-subtraction and
reducing the planet throughput. In this paper, we present an algorithm that
directly optimizes the non-linear equation for planet signal to noise ratio
(SNR). This new algorithm does not require us to reject adjacent reference
images and optimally balances noise reduction with self-subtraction. We then
show how this algorithm can be applied to multiple images simultaneously for a
further reduction in correlated noise, directly maximizing the SNR of the final
combined image. Finally, we demonstrate the technique on an illustrative
sequence of HR8799 using the new Julia-based Signal to Noise Analysis Pipeline
(SNAP). We show that SNR optimization can provide up to a $5\times$ improvement
in contrast close to the star. Applicable to both new and archival data, this
technique will allow for the detection of lower mass, and closer in companions,
or achieve the same sensitivity with less telescope time.
