When should I file my patent application?

Generally speaking if you are going to file for patent protection you should do this as soon as possible following the conception of the invention to avoid a public disclosure of the invention which can have a negative impact on the patentability of the invention in many corners of the world.  There is significant limitation to patentability in various countries if the invention is disclosed to the public in advance of filing of a patent application.