This functionality is available since version 2.3.0!

By default, the resource is marked as overloaded, if it has more items assigned than a limit. 

Imagine you want to mark the resource as overloaded only if the resource has more UNRESOLVED (i.e. open) items assigned than a limit.

Example: you want to achieve the situation as on the following screenshot: Steve Developer is overloaded on Dec-18  but not on Dec-19 because on that date all tasks are resolved, except one task (the only unresolved is EL-136).

To configure this, add the following script to Widget Properties > Advanced > Gantt Script

gantt.templates.checkOverloadedResource_function = function(start_date, end_date, resource, tasks){
    var unresolved_tasks =  tasks.filter(task => !task.resolved);    
    if(unresolved_tasks.length > 1){
        return true;
        return false;

Of course, you can write more complex scripts, e.g. taking into account partial assignments such as if the task does not load the resource to 100%.