To understand the causes of coronal mass ejections (CMEs) deflections is essential for the space weather forecast. We perform ideal magnetohydrodynamics simulations emulating the early rising of the CME in the presence of a coronal hole (CH) and study the effects on CMEs trajectories produced by the different properties of a CH. We find that larger CME deflections are produced by a stronger magnetic field and a wider CH area. The deflection reduces as the CH moves away from the ejection region. Also, we show that a minimum magnetic energy region, responsible for the deflection, is associated with the presence of the CH near the CME. Finally, we establish a relationship between the coronal hole properties (through a dimensionless parameter), the location of the minimum magnetic region and the CME deflection.