To round off just in case the good work of the previous ones, if we want to activate it it's the same but adding the '!' to the conditional:
<<Global variables>>
#include <WinAPI/winapi.mqh>
#include <WinAPI/winuser.mqh>
#define MT_WMCMD_EXPERTS 32851
#define WM_COMMAND 0x0111
#define GA_ROOT 2
<<Settings>>
if (!TerminalInfoInteger(TERMINAL_TRADE_ALLOWED)){
HANDLE hchart = ChartGetInteger(ChartID(), CHART_WINDOW_HANDLE);
HANDLE hmt = GetAncestor(hchart, GA_ROOT);
PostMessageW(hmt, WM_COMMAND, MT_WMCMD_EXPERTS, 0);
}