  Imaging companions to main-sequence stars often allows to detect a projected
orbital motion. MCMC has become very popular in for fitting their orbits. Some
of these companions appear to move on very eccentric, possibly unbound orbits.
This is the case for the exoplanet Fomalhaut b and the brown dwarf companion PZ
Tel B. For such orbits, standard MCMC codes assuming only bound orbits may be
inappropriate. We develop a new MCMC implementation able to handle bound and
unbound orbits as well in a continuous manner, and we apply it to the cases of
Fomalhaut b and PZ Tel B.
  This code is based on universal Keplerian variables and Stumpff functions
formalism. We present two versions of this code, the second one using a
different set of angular variables designed to avoid degeneracies arising when
the projected orbital motion is quasi-radial, as it is the case for PZ Tel B.
We also present additional observations of PZ Tel B.
  The code is applied to Fomalhaut b and PZ Tel B. Concerning Fomalhaut b, we
confirm previous results, but we show that open orbital solutions are also
possible. The eccentricity distribution nevertheless peaks around ~0.9 in the
bound regime. We present a first successful orbital fit of PZ Tel B, showing in
particular that the eccentricity distribution presents a sharp peak very close
to e=1, meaning a quasi-parabolic orbit.
  It was recently suggested that unseen inner companions may lead orbital
fitting algorithms to artificially give high eccentricities. We show that this
caveat is unlikely to apply to Fomalhaut b. Concerning PZ Tel B, an inner ~12
MJup companion would mimic a e=1 orbit despite a real eccentricity around 0.7,
but a dynamical analysis reveals that such a system would not be stable. We
conclude that our orbital fit is robust.

Earth and Planetary Astrophysics