Halloween has its origins in pagan practice, and lacks any overt rationale for its celebration other than its pagan origins or the Catholic response to it, is governed by the statement of the Rema (Rabbi Isserless) that such conduct is prohibited as its origins taint it. Participation in Halloween celebrations -- which is what collecting candy is when one is wearing a costume -- is prohibited. One should not send one's children out to trick or treat on Halloween, or otherwise celebrate the holiday. 

There are significant reasons based on dakei shalom (the ways of peace), eva (the creation of unneeded hatred towards the Jewish people) and other secondary rationales that allow one to distribute candy to people who will be insulted or angry if no candy is given. This is even more so true when the community -- Jewish and Gentile -- are unaware of the halachic problems associated with the conduct. Thus, one may give candy to children who come to one's house to "trick or treat" if one feels that this is necessary.