The icon turns red when an alert condition occurs for an alert that has "Tray icon change / notification" as one of its events. The conditions you set on that alert control at what point the icon changes from green to red and when it returns to green again.