Implicit conversion from number to string

 
Hello All

So I'm trying to find a much more efficient way of converting an integer or a double to string, without typing 
+IntegerToString(AccountNumber(),0)+

every time I use a Mail, Print or MessageBox function.

I believe that you can apply the following:

string thisIsTheAccountNumber        = int(IntegerToString(AccountNumber(),0));

and then just use the converted variable name like this : 

SendMail("This is your account number.","The Account Number is: #"+(thisIsTheAccountNumber));

however, I get the warning "implicit conversion from number to string" in the terminal journal. We know this is a conversion, so how would I remove this warning?

Many thanks and all the best,

Documentation on MQL5: Common Functions / MessageBox
Documentation on MQL5: Common Functions / MessageBox
  • www.mql5.com
MessageBox - Common Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
  1. TheHonestPrussian: however, I get the warning "implicit conversion from number to string" in the terminal journal. We know this is a conversion, so how would I remove this warning?
    string thisIsTheAccountNumber        = int(IntegerToString(AccountNumber(),0));

    You are converting the account number to a string. Then back to an int. Then implicitly back to a string. What are you thinking?

    string thisIsTheAccountNumber        = IntegerToString(AccountNumber());

  2. Or just do your conversions only when you need it.

    SendMail("This is your account number.",StringFormat("The Account Number is: #%d",AccountNumber()));
Reason: