Localization for controlled random walks and martingales