#property copyright "Copyright 2025, MetaQuotes Ltd."
#property link ""
#property version "1.00"
#property script_show_inputs
#property description "The script deletes global variables of the client terminal."
#property description "Limit date: Variables before the specified date are deleted."
#property description "If is zero, then variables that match the Name prefix criterion are deleted."
#property description "Name prefix: Prefix of the variable name. If not specified, then variables are deleted based on the Limit date criterion."
#property description "If all input parameters are zero, then all global variables are deleted."
#property description "If both parameters are specified, then global variables corresponding to each of the specified parameters are deleted."
//--- input変数
input datetime InpLimitDate= 0; // リミット日
input string InpPrefix = NULL; // 名前の接頭辞
//+------------------------------------------------------------------+
//| スクリプトプログラム開始関数 |
//+------------------------------------------------------------------+
void OnStart()
{
//--- クライアント端末のグローバル変数の総数を取得する
//--- スクリプト設定で選択された削除条件に従って変数を削除し
//--- 削除結果をログに出力する
int total=GlobalVariablesTotal();
int deleted=GlobalVariablesDeleteAll(InpPrefix, InpLimitDate);
PrintFormat("Of %d global variables, %d have been removed. %d remain", total, deleted, total-deleted);
/*
結果:
Of 21 global variables, 21 have been removed. 0 remain
*/
}
|