Sure, daytime is easy. Fail to meet any of those conditions at night and the pirates are on board. If something goes wrong and the pirates decide they don't want witnesses (such as they shoot and kill someone during the gun battle), you've simply guaranteed that everyone else gets shot and tossed overboard. Probably with your bullets.
It's counter-intuitive, I know--but that is the historical perspective. Everyone wants to be a hero. They can't be here. The pirates are after your goods and maybe the ship. They don't want to kill you. But they will. And they'll have little problem doing so unless you turn your ship into an armed fortress. Concertina wire a plus . . . it'll leave cute rust marks.
So go ahead. Name your pretty little ship the Khe Sanh. Let's see how many tickets you sell.
http://www.youtube.com/watch?v=nYvEFATaRMY
If you actally read reports on piracy (they publish ‘em on the net) a lot pirates are stopped by alert crews and high-pressure hoses. Alert crews and autocannons might go a long way toward putting them out of business.
Of course the only way to actually put them out of business is to pursue 'em into their home ports and burn the port down around the ears of the pirates and their supporters. Nobody really seems to have the balls to do that any more.