当前位置:网站首页>Mt4/mql4 getting started to mastering EA tutorial lesson 5 - common functions of MQL language (V) - common functions of account information

Mt4/mql4 getting started to mastering EA tutorial lesson 5 - common functions of MQL language (V) - common functions of account information

2022-06-22 08:01:00 EA development - green shirt code customer

bool IsConnected();

Check whether the connection between the client and the server is normal

The script instance

//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart() 
  {
     
   if(!IsConnected()) 
    {
     
     Print(" The connection fails !");  
    } 
    else Print(" The connection is normal !");  
  }

Running results
 Insert picture description here
Manually disconnect , To run a
 Insert picture description here
Show connection failure
 Insert picture description here
This function is used to check whether the network connection is normal , Whether the server is disconnected

bool IsDemo();

This function is used to detect whether the account is simulated


void OnStart() 
  {
     
   if(IsDemo()) Print(" This is a mock account !");
    else Print(" This is not a simulated account !");  
  }

Running results
 Insert picture description here
bool IsExpertEnabled();

This function is used to detect whether automatic transaction is allowed ;

The script instance

void OnStart() 
  {
     
   if(IsExpertEnabled())  Print(" Allow automatic transactions !");
    else Print(" Automatic transactions are not allowed !");  
  }
  

Turn off automatic transactions
 Insert picture description here
Run the script
 Insert picture description here
Turn on automatic transaction , Run the script
 Insert picture description here
 Insert picture description here

A good workman does his work well , You must sharpen your tools first , The most important thing in trading is to follow the rules , Strictly carry out . Official account , Study MQL Beginner to master EA course , Learn more EA Programming , Write your own EA, Forge your own magic weapon .
 Insert picture description here

原网站

版权声明
本文为[EA development - green shirt code customer]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202220530131114.html