Order "hold position" does not work

When I tell a unit to hold a possition it attacks after a short time on its own and doesn’t hold the possition.