LIP/Arch/RU/Test_02.mq5

180 lines
9.1 KiB
MQL5
Raw Permalink Normal View History

2025-05-30 15:03:51 +02:00
<EFBFBD><EFBFBD>//1. =AB@C<5=B
//2. "8:5B
//3. 038:
//4. ?5@0F8O
void OnInit(){
//-----
datetime TimeSet=0;
double DateSet=0.0;
{if(GlobalSetDouble("tst_01",TimeSet,999.999))
{
Print("TimeSet1=",TimeSet);
{if(GlobalGetDouble("tst_01",DateSet))
{
Print("DateSet1=",DateSet);
}}//if(GlobalGetDouble("tst_01",DateSet))
}}//if(GlobalSetDouble("tst_01",999.999,TimeSet))
//-----
string StringSet="";
{if(GlobalSetString("tst_02",TimeSet,"EURUSD.z"))
{
Print("TimeSet2=",TimeSet);
{if(GlobalGetString("tst_02",StringSet))
{
Print("StringSet2=",StringSet);
}}//if(GlobalGetString("tst_02",StringSet))
}}//if(GlobalSetString("tst_02",TimeSet,"EURUSD.z"))
//-----
ulong UlongSet=0;
{if(GlobalSetUlong("tst_03",TimeSet,56456198741))
{
Print("TimeSet3=",TimeSet);
{if(GlobalGetUlong("tst_03",UlongSet))
{
Print("UlongSet3=",UlongSet);
}}//if(GlobalGetUlong("tst_03",UlongSet))
}}//if(GlobalSetString("tst_03",TimeSet,56456198741))
}//OnInit()
bool GlobalSetDouble(string iName,datetime &iTimeSet,double iDateSet=0.0){
//-----
iTimeSet=GlobalVariableSet(iName,iDateSet);
{if(iTimeSet!=0)//=0G5=85 C40;>AL CAB0=>28BL
{
return(true);
}else{//5 C40;>AL CAB0=>28BL
return(false);
}}//if(iTimeSet!=0)
//-----
return(false);
}//GlobalSetDouble()
bool GlobalGetDouble(string iName,double &iDateGet){
//-----
iDateGet=0.0;
{if(GlobalVariableCheck(iName))//5@5<5==0O 5ABL
{
{if(GlobalVariableGet(iName,iDateGet))//=0G5=85 C40;>AL AG8B0BL
{
return(true);
}else{//5 C40;>AL AG8B0BL
iDateGet=0.0;
return(false);
}}//if(GlobalVariableGet(iName,iDateGet))
}else{//5@5<5==>9 =5B
iDateGet=0.0;
return(false);
}}//if(GlobalVariableCheck(iName))
//-----
return(false);
}//GlobalGetDouble()
//
bool GlobalSetString(string iName,datetime &iTimeSet,string iStringSet=""){
//-----
union ulong_double
{
double iDateSet;
ulong iLongSet;
uchar iCharSet[8];
};
ulong_double ud;
ud.iLongSet=0;
//-----
StringToCharArray(iStringSet,ud.iCharSet,0,8);
//-----
iTimeSet=GlobalVariableSet(iName,ud.iDateSet);
{if(iTimeSet!=0)//=0G5=85 C40;>AL CAB0=>28BL
{
return(true);
}else{//5 C40;>AL CAB0=>28BL
return(false);
}}//if(iTimeSet!=0)
//-----
return(false);
}//GlobalSetString()
bool GlobalGetString(string iName,string &iStringGet){
//-----
iStringGet="";
//-----
union ulong_double
{
double iDateGet;
ulong iLongGet;
uchar iCharGet[8];
};
ulong_double ud;
ud.iLongGet=0;
//-----
{if(GlobalVariableCheck(iName))//5@5<5==0O 5ABL
{
{if(GlobalVariableGet(iName,ud.iDateGet))//=0G5=85 C40;>AL AG8B0BL
{
iStringGet=CharArrayToString(ud.iCharGet,0,8);
return(true);
}else{//5 C40;>AL AG8B0BL
iStringGet="";
return(false);
}}//if(GlobalVariableGet(iName,ud.iDateGet))
}else{//5@5<5==>9 =5B
iStringGet="";
return(false);
}}//if(GlobalVariableCheck(iName))
//-----
iStringGet="";
return(false);
}//GlobalGetString()
//
bool GlobalSetUlong(string iName,datetime &iTimeSet,ulong iUlongSet=0){
//-----
union ulong_double
{
double iDateSet;
ulong iLongSet;
};
ulong_double ud;
ud.iLongSet=iUlongSet;
//-----
iTimeSet=GlobalVariableSet(iName,ud.iDateSet);
{if(iTimeSet!=0)//=0G5=85 C40;>AL CAB0=>28BL
{
return(true);
}else{//5 C40;>AL CAB0=>28BL
return(false);
}}//if(GlobalVariableGet(iName,iDate))
//-----
return(false);
}//GlobalSetDouble()
bool GlobalGetUlong(string iName,ulong &iUlongGet){
//-----
iUlongGet=0;
//-----
union ulong_double
{
double iDateGet;
ulong iLongGet;
};
ulong_double ud;
ud.iLongGet=0;
//-----
{if(GlobalVariableCheck(iName))//5@5<5==0O 5ABL
{
{if(GlobalVariableGet(iName,ud.iDateGet))//=0G5=85 C40;>AL AG8B0BL
{
iUlongGet=ud.iLongGet;
return(true);
}else{//5 C40;>AL AG8B0BL
iUlongGet=0;
return(false);
}}//if(GlobalVariableGet(iName,iDate))
}else{//5@5<5==>9 =5B
iUlongGet=0;
return(false);
}}//if(GlobalVariableCheck(iName))
//-----
iUlongGet=0;
return(false);
}//GlobalGetDouble()