How to know ticket is active or is been opened?

I am trying to do this:
If(ticket-is-active){
Change-ticket-status-to = open;
}

If(group == Group-ID){
Change-ticket-status-to = pending;
}