Your logic is correct. That means the problem must be in the terminal or in the way your broker is dealing with fxDreema code. Can you try the same EA on other brokers? That will confirm or not the issue.
How are you implementing this code, it does not work for me. Then again I am using mt5. Manage to get the link below work but if I can do this all without using the custom block feature that would be better.