#property copyright "Copyright 2025, MetaQuotes Ltd."
#property link "https://www.mql5.com"
#property version "1.00"
#property script_show_inputs
#property description "스크립트는 클라이언트 터미널의 전역 변수를 삭제합니다."
#property description"제한 날짜: 지정된 날짜 이전의 변수는 삭제됩니다."
#property description"만약 0 이면 Name 접두사 기준과 일치하는 변수가 삭제됩니다."
#property description "Name 접두사: 변수명 접두사 지정하지 않으면 변수는 제한 날짜 기준에 따라 삭제됩니다."
#property description "모든 입력 매개변수가 0 이면 모든 전역 변수가 삭제됩니다."
#property description "두 매개변수가 모두 지정되면 지정된 각 매개변수에 해당하는 전역 변수가 삭제됩니다."
//--- 입력 변수
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
*/
}
|