Sure you cannot add number to string... you should convert it first to string
like this:
extern string co = "My custom EA "; //EA Comment: string com = co + "(Spread: " + IntegerToString( ( int) MarketInfo( Symbol(), MODE_SPREAD)) + ")";
Thanks very much!!!
You might also want to try format strings. They make your code a lot easier to read and write. Here's an example:
string ea_name = "My EA"; string comment = StringFormat("%s (Spread: %d)", ea_name, int(MarketInfo(_Symbol, MODE_SPREAD)) );

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi everyone
I am currently testing the results of an EA and would like to know the spread with which it opens each operation, so I have the idea of adding that data to the comment when opening the operation: "Name of my EA" + "spread".
The way I'm doing it is:
However when compiling it shows me the error: "implicit conversion from 'number' to 'string'.
How should I do that?
What is the correct way to do it?