I think it will be very difficult to avoid the hacker when you still store your wallet online. But, we can minimize it by making more than one wallet and store our private key offline. Additionally, using Meta mask may be much better than the MEW.
But, if you have had more profits, it is better to buy the hardware wallet first.