In this paper, we consider a company that wishes to determine the optimal reinsurance
strategy minimising the total expected discounted amount of capital injections
needed to prevent the ruin. The company's surplus process is assumed to follow a
Brownian motion with drift, and the reinsurance price is modelled by a continuous-time
Markov chain with two states. The presence of regime-switching complicates
substantially the optimal reinsurance problem, as the surplus-independent strategies
turn out to be suboptimal. We develop a recursive approach that allows to
represent a solution to the corresponding Hamilton-Jacobi-Bellman equation and
the corresponding reinsurance strategy as the unique limits of the sequence of
solutions to ordinary differential equations and their first and second order derivatives.
Via Ito's formula we prove the constructed function to be the value function.
Two examples illustrate the recursive procedure along with a numerical approach
yielding the direct solution to the HJB equation.