From the Smithsonian....
"The Celts believed that, as we moved from one year to the next, the dead and the living would overlap, and demons would roam the earth again. So dressing up as demons was a defense mechanism. If you encountered a real demon roaming the Earth, they would think
you were one of them.
Fast forward to when the Catholic Church was stealing everybody’s holidays and trying to convert them. They turned the demon dress-up party into “All Hallows Eve,” “All Soul’s Day,” and “All Saints Day” and had people dress up as saints, angels and still a few demons.
"The Celts believed that, as we moved from one year to the next, the dead and the living would overlap, and demons would roam the earth again. So dressing up as demons was a defense mechanism. If you encountered a real demon roaming the Earth, they would think
you were one of them.
Fast forward to when the Catholic Church was stealing everybody’s holidays and trying to convert them. They turned the demon dress-up party into “All Hallows Eve,” “All Soul’s Day,” and “All Saints Day” and had people dress up as saints, angels and still a few demons.
As for the trick or treating, or “guising” (from “disguising”), traditions, beginning in the Middle-Ages, children and sometimes poor adults would dress up in the aforementioned costumes and go around door to door during Hallowmas begging for food or money in exchange for songs and prayers, often said on behalf of the dead. This was called “souling” and the children were called “soulers”.
The term “trick or treat” dates back to 1927."
From J.KerbyAnderson......
"Occultists taught that spirits and ghosts left the grave during this night and would seek out warmth in their previous homes. Villagers, fearful of the possibility of being visited by the ghosts of past occupants, would dress up in costumes to scare the spirits on their way. They would also leave food and other treats at their door to appease the spirits so they would not destroy their homes or crops but instead move on down the road. That is the real reason why kids dress up in costumes today and go door-to-door seeking treats."
"Occultists taught that spirits and ghosts left the grave during this night and would seek out warmth in their previous homes. Villagers, fearful of the possibility of being visited by the ghosts of past occupants, would dress up in costumes to scare the spirits on their way. They would also leave food and other treats at their door to appease the spirits so they would not destroy their homes or crops but instead move on down the road. That is the real reason why kids dress up in costumes today and go door-to-door seeking treats."
For the living know that they shall die: but the dead know not any thing,..
Ecclesiastes 9:5