Polyatomic polar molecules are promising systems for future experiments that search for violation of time-reversal and parity symmetries due to their advantageous electronic and vibrational structure, which allows laser cooling, full polarisation of the molecule, and reduction of systematic effects [I. Kozyryev and N.R. Hutzler, Phys, Rev. Lett. {bf 119}, 133002 (2017)]. In this work we investigate the enhancement factor of the electric dipole moment of the electron ($E_text{eff}$) in the triatomic monohydroxide molecules BaOH and YbOH within the high-accuracy relativistic coupled cluster method. The recommended $E_text{eff}$ values of the two systems are 6.65 $pm$ 0.15 GV/cm and 23.4 $pm$ 1.0 GV/cm, respectively. We compare our results with similar calculations for the isoelectronic diatomic molecules BaF and YbF, which are currently used in experimental search for $P,T$-odd effects in molecules. The $E_text{eff}$ values prove to be very close, within about 1.5 $%$ difference in magnitude between the diatomic and the triatomic compounds. Thus, BaOH and YbOH have a similar enhancement of the electron electric dipole moment, while benefiting from experimental advantages, and can serve as excellent candidates for next-generation experiments.