I run 20 regularly on a dedicated server. If you're co-hosting on a VPS someone else might be getting your resources. I don't think I'd have any problem going to 40 or higher.
But I also have a very high spec server, 32 GIG RAM and everything that comes with that...
Actually metaquotes imposes a limit of 32 MT4 instances on computer/vps/server.
So no, you cant run 40. You can run 32 max.
I run 32 on my dedicated server, with optimization it runs smoothly, without opt it is terrible regardless the params.
2016.12.09 09:06:05.971 Windows Server 2012 R2 Standard (x64 based PC), IE 11.00, RDP, UAC, 12 x Intel Core i7-3930K @ 3.20GHz, RAM: 45575 / 64947 Mb, HDD: 2492809 / 2861258 Mb, GMT+01:00