  This paper introduces a new recursive stochastic optimal control problem
driven by a forward-backward stochastic differential equations (FBSDEs), where
the ter?minal time varies according to the constraints of the state of the
forward equation. This new optimal control problem can be used to describe the
investment portfolio problems with the varying investment period. Based on
novel \r{ho}-moving variational and adjoint equations, we establish the
stochastic maximum principle for this optimal control problem including the
classical optimal control problem as a particular case. Furthermore, we propose
an example to verify our main results.
