my script is based on 13 assets on different time frames, and I am doing something similar to your code, but what happen, for instance, if the market is closed for an national holiday during a trading day?
Your code, as mine, is not able to track that event. Having the opportunity to check if an asset is tradable right before to open a position could help a lot.
In Multichart the trading time is listed in the platform, so I guess that could be possible to gather such information from the broker.
I hoped this could be possible in Zorro.
Naturally nobody can guarantee that your order will be 100% executed, but this will reduce the number of exceptions.