Luck has been accurately defined as what you get when preparation meets opportunity. Basically, you get good fortune when you prepare yourself to meet whatever goals you have set for yourself, as opportunities to do so present themselves.
Conversely, bad luck is when you fail to prepare to be ready for an opportunity and therefore miss opportunities. So, the best way to avoid bad luck is to always be prepared to take advantage of opportunities that come your way.
Luck does not exist, good or bad. Good luck is something that coincidentally goes to your favor. It happens to everybody. It's just a coincidence. If you believe in bad luck, then you are going to notice every little bad thing that happens in your life. There is no bad luck. There's just unfortunate things happening. Think positively in life. See the bright side in the bad things.