#property copyright "Copyright 2025, MetaQuotes Ltd."
#property link "https://www.mql5.com"
#property version "1.00"
#define GV_NAME "TestGlobalVariableDel"
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//--- check for the presence of the client terminal global variable named GV_NAME
if(!GlobalVariableCheck(GV_NAME))
{
PrintFormat("Terminal global variable named \"%s\" does not exist", GV_NAME);
return;
}
//--- delete the client terminal global variable named GV_NAME
if(!GlobalVariableDel(GV_NAME))
{
Print("GlobalVariableDel() failed. Error ",GetLastError());
return;
}
//--- check the success of deleting the client terminal global variable named GV_NAME
if(!GlobalVariableCheck(GV_NAME))
{
PrintFormat("The terminal global variable named \"%s\" was successfully deleted", GV_NAME);
}
/*
result in case of the absence of the client terminal global variable with the name GV_NAME
Terminal global variable named "TestGlobalVariableDel" does not exist
result in case of the presence of the client terminal global variable with the name GV_NAME
The terminal global variable named "TestGlobalVariableDel" was successfully deleted
*/
}
|