  We study optimal liquidation of a trading position (so-called block order or
meta-order) in a market with a linear temporary price impact (Kyle, 1985). We
endogenize the pressure to liquidate by introducing a downward drift in the
unaffected asset price while simultaneously ruling out short sales. In this
setting the liquidation time horizon becomes a stopping time determined
endogenously, as part of the optimal strategy. We find that the optimal
liquidation strategy is consistent with the square-root law which states that
the average price impact per share is proportional to the square root of the
size of the meta-order (Bershova and Rakhlin, 2013; Farmer et al., 2013; Donier
et al., 2015; T\'oth et al., 2016).
  Mathematically, the Hamilton-Jacobi-Bellman equation of our optimization
leads to a severely singular and numerically unstable ordinary differential
equation initial value problem. We provide careful analysis of related singular
mixed boundary value problems and devise a numerically stable computation
strategy by re-introducing time dimension into an otherwise time-homogeneous
task.
