You don't have to be good in order to have a guardian angel, He is the gift of God to you so that you will always receive a message from God telling you His will.
The guardian angel is the constant companion given to every soul, for the purpose of his advice and guidance. He will help you so many times and you won't even know it. But He will defend you from the attacks of the evil one.
20 I am going to send an angel in front of you, to guard you on the way and to bring you to the place that I have prepared.
21 Be attentive to him and listen to his voice; do not rebel against him, for he will not pardon your transgression; for my name is in him.
22 But if you listen attentively to his voice and do all that I say, then I will be an enemy to your enemies and a foe to your foes. (NRSV)
To my guardian Angel Prayer
Angel of God, my guardian dear, to whom God's love commits me here, ever this day, be at my side, to light and guard, rule and guide.