Yes. Booting to macOS from an external drive is super easy. Just use disk utility to wipe it and install the OS. Installing Windows is possible but a bit trickier and I've never tried it on an external drive. 9to5Mac has a detailed guide on how to set it up: https://9to5mac.com/2017/08/31/how-windows-10-mac-boot-camp-external-drive-video/
Just one thing to note, however, is that Windows installed on an external drive most probably would not be able to read the internal drive at all. This would not be an issue with macOS though.