The response function of a time-varying filter changes with the output signal, or observation time. Most existing time-varying filter techniques involve the empirical division of a seismic trace into a number of gates (or time windows) of given length, and a time-invariant filter is determined for each such gate. Few treatments have dealt with analytical methods to establish the gate lengths according to some optimum criterion.This paper describes a technique for the determination of optimum gate lengths. It is based on the work of Berndt and Cooper, which is here applied to the calculation of time-varying Wiener filters. The Berndt and Cooper technique produces an upper bound for the mean-square error between the true and a given approximated time-varying correlation function. The minimization of this upper bound leads to a relation which enables one to establish gate lengths directly from the input trace. Thereafter, ordinary time-invariant Wiener filters can be computed for each gate. The overall filtered trace is obtained in the form of a suitably combined version of the individually filtered gates.Experimentally it is shown that, with the Berndt and Cooper technique to determine optimum gate lengths, time-varying Wiener filters can be better than a time-invariant filter.