There is not such a thing as optimal level to utilize max damage, because this depends on the defender. To answer your question it would be level 40, but that's not the answer that you're looking for.
In general, people look up the breakpoint for quick moves. In this case that would be counter. I've searched the breakpoint level for the quick move "counter" against the most common raid bosses where I would use a Machamp (15 attack IV) for.
Lapras: 31
Snorlax: 37.5
Tyranitar: 36
Included the table for Machamp (attacker) vs Tyranitar (raid boss defender)