I’d say you’re never too old! However, society might have a different opinion on that.
I think anyone of any age, considering they’re still in good walking health would have fun trick or treating, but we all know how most would react to a 40-year-old for example walking up to their door saying trick or treat, they’d likely give them a piece of candy quickly and close the door or refuse.
I think for those of us that have children that’s about the only way to “safely” enjoy the tradition anymore.
To put it in a number, probably 13 is close to the social cut-off.