As a voluntary patient on a psychiatric ward, you are in the same position as a voluntary patient on any other type of hospital ward, which means you are legally free to leave hospital as and when you choose.
However, if nurses on the ward are concerned that it will be too risky for you to leave hospital, they may consider using their temporary holding powers under s5 of the MHA, which means that you can be kept on the ward for a limited period, in order for an assessment under the MHA to take place.