Enabling/Disabling All Triggers

Triggers can be disabled for a session without having to explicitly remove them from the administrative definitions to which they belong. This is helpful during testing and troubleshooting.

You can execute the following command from MQL provided that the current user is defined as a System Administrator.

trigger off;

After this command executes, events that occur on the local machine which have associated triggers do not cause the programs to execute.

This command affects only the local machine; concurrent user sessions are not affected. Even when multiple users are sharing one executable, each user is isolated from all other users. In addition, subsequent sessions on the local machine will have triggers enabled by default.

To enable defined triggers again, a System Administrator should use:

trigger on;

MQL also allows triggers to be enabled or disabled with the use of a toggle command. Depending on the current setting, triggers can be enabled/disabled using the same command.

To enable/disable triggers as a toggle, a System Administrator should use:

trigger;