I forgot to mention - you need to eliminate the loop() call. For that, you can load an asset list and use one of the asset loops instead:
https://manual.zorro-project.com/fortrades.htm