We study a continuous-time model of consumption and portfolio selection with the stochastic investment opportunity and the credit constraints endogenously determined in the business cycle modeled by the regime switch. By using the martingale approach and transformation into optimal stopping...