Sharing the idea for your invention too soon with others can result in your invention not being new or not having an inventive step anymore and thus not being patentable. Therefore, if you want to share the idea for your invention with others you should only do this if you have taken appropriate measures to ensure that your invention does not become public (e.g. by disclosing it under a non-disclosure agreement). Or you can also decide to disclose it only after your patent application has been filed.
Once you filed your patent application the patent office will make it public (official publication) after 18 months with the purpose of sharing state-of-the-art technology. Between filing your application and the official publication, you can already share your invention yourself if you do not want to keep it confidential anymore and do not mind making it public. During this period, you can state that you have a patent pending, which might be a good marketing strategy. In general, patents are granted after 18 months (around the time of the official publication). Protection runs from the moment that your patent application is filed. Once your patent is officially granted, you will be able to take action against counterfeiters.