Go to requirements tab in data editor and create new requirement. Let's name it "hero complete".
Select it and on you right you will see "use" and "show".
Right click "show" and add new element. Pick "not" from the list .
Right click "not" and create new element, this time select "or".
Right click "or" and create 4 elements for it "compare unit count".
In each element choose each of your heroes and set it as "queued or better" or "completef".
Go to train ability of your heroes, scroll down to requirements and find "hero completed".
This makes the train button for your heroes dissapear if you start training one (if you chose queued or better) or have one on the map (if you chose completed).
If you want the button greyed out instead, do the same thing but create new elements in requirement under "use", not "show", so it looks like "use - not - or - 4 heroes, queued or better/ completed"
There is a somewhat simpler way to do this, and also scales a bit better.
In the Unit, there is a field called "Tech Alias". You can assign a name (it can be anything). Anything with the same alias will be counted in Requirements. In the requirement, instead of checking if every hero is 0, just check for the tech aliase (it will appear once you create it on a unit).
The advantage of this is once you setup the requirement, you will not need to change it each time a new hero is added, just add the alias to the new hero.