How to check in MQL 5 Account type is demo or live?

 

Hello Everyone,

I am vew new in MQL 5 programming please guide me that how could I check in MQL 5 that Account type is demo or live?


Thank u in advance.

Regards,

Kumail Raza

 
  ENUM_ACCOUNT_TRADE_MODE tradeMode=(ENUM_ACCOUNT_TRADE_MODE)AccountInfoInteger(ACCOUNT_TRADE_MODE); 

//--- Find out the account type 
   switch(tradeMode) 
     { 
      case(ACCOUNT_TRADE_MODE_DEMO): 
         Print("This is a demo account"); 
         break; 
      case(ACCOUNT_TRADE_MODE_CONTEST): 
         Print("This is a competition account"); 
         break; 
      default:Print("This is a real account!"); 
     } 
 

This answer will work most of the time, but unfortunately I just discovered one specific case which is not working.

I have a demo account which does not expire and in this case MT5 return me that it is a Real account.

I do not know if some other properties of the account could tell me that it is a demo or real ?

 
Thanksssss
Reason: