  The problem of optimal stopping with finite horizon in discrete time is
considered in view of maximizing the expected gain. The algorithm proposed in
this paper is completely nonparametric in the sense that it uses observed data
from the past of the process up to time $-n+1$, $n\in\mathbb{N}$, not relying
on any specific model assumption. Kernel regression estimation of conditional
expectations and prediction theory of individual sequences are used as tools.
It is shown that the algorithm is universally consistent: the achieved expected
gain converges to the optimal value for $n\to\infty$ whenever the underlying
process is stationary and ergodic. An application to exercising American
options is given, and the algorithm is illustrated by simulated data.
