#property copyright "Copyright 2025, MetaQuotes Ltd."
#property link ""
#property version "1.00"
#define GV_NAME "TestGlobalVariableSet"
#define GV_VALUE 1.23456
//+------------------------------------------------------------------+
//| 스크립트 프로그램 시작 함수 |
//+------------------------------------------------------------------+
void OnStart()
{
//--- 새로운 GV_VALUE 값을 클라이언트 터미널의 전역 변수인 GV_NAME으로 설정합니다.
//--- 변수가 아직 존재하지 않으면 생성됩니다.
if(GlobalVariableSet(GV_NAME, GV_VALUE)==0)
{
Print("GlobalVariableSet() failed. Error ", GetLastError());
return;
}
//--- 결과를 확인하고 저널에 출력합니다.
double value=0;
if(GlobalVariableGet(GV_NAME, value))
{
PrintFormat("The global variable of the client terminal named \"%s\" is set to %.5f", GV_NAME, value);
}
/*
결과:
The global variable of the client terminal named "TestGlobalVariableSet" is set to 1.23456
*/
}
|