looks like a very neat piece of code...maybe you have seen a code which can do similar stuff for mt4?
Sorry. Have never tried mt4. However, there are tons of code examples also for mt4 at their site. At least I think so. However, this code is just to run in a Python interpreter, and it will work as it is. Just get the token and an account