I understand little bit why define the MAFIC_NUMBER as an integer, not a string? I think define it as a string is much better than as an integer since you can transform an integer to a string but nit vise verse, right? Besides a string can tell much more than an integer. Right?
Just accept it, it's the way it is.
Beside that an integer can be sorted easier than a string (with or without capitals, special characters,...) and you have the comment of a position which is a string.
Yes, there is the comment. But can I just use the comment, not the magic number to tell the different orders? Or must I use different magic numbers as well for different order?
string ORDER_COMMENT = EURUSD15M;
for(int i=OrdersTotal()-1; i >= 0; i--)
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
if(OrderType()==OP_BUY && OrderComment() == ORDER_COMMENT)
A string can be understood much better than an integer.
It's defined as integer because otherwise it would have to be called not MAGIC_NUMBER but MAGIC_WORD and people would start writing silly things for it.
There is StringToInteger and StringToCharArray function if you really want to make things complicated though.
An integer is a number and will always be a number.
But with a string there are several encoding's for example like 'UTF-8' 'Latin-1' and many more.
Errors are very easy to occur due to incompatibility between types, when these get mixed up for whatever reason.
It should be an int and it should stay an int.
The only type that i ever would consider would be a immutable bytestring but that's simply overkill in this case.
Cuold you please convert the "Hello World" to integer? I do want to see what it looks like. :-D