I have never managed to successfully roast chestnuts on an open fire. I tend to end up with charred chestnuts, which are inedible.
Is there a good technique for this?
Some might call this cheating, but I've found that boiling chestnuts tends to make them easier to eat. Roasting them can sometimes dry them out. I also find they keep their natural sugars intact better so they taste sweeter!
In Spain, the traditional way is using something like this:
Or a pan with holes. The big day to do it is called Magosto and it's celebrated on 11/11, but it varies from town to town. It's one of the closest things to a barbecue, you first roast chorizos, then you roast chestnuts.
If you don't have access to those tools, your best option is to put them close to the fire. Make a small cut in almost each chestnut (to release moisture). The ones without the cut will pop and tell you when they start to be done. Start checking for doneness at that point.
Maybe you already knew about the cut, but I know some people don't roast at home because they don't know it can be done in a regular oven if the cuts are in place to avoid the chestnuts popping wildly.