Change Candidate Status via custom function

Change Candidate Status via custom function

scenario: after an X number of days, i need to change the candidate status to another status... right now, i can change all fields except candidate status... I also so that id is defaulted to read-only

Can you please give me sample of how i can do this?