Download MetaTrader 5

string EA input parameter is truncated. Why?, some workaround?

To add comments, please log in or register
Use searching on MQL5.community. It is easy!
cyberglassed
611
cyberglassed 2014.06.13 23:28 

Hello folks, I have an EA with the following source code.

I pass some configuration through the inputs parameters like bellow:

input string settings = "A 0123456789. B 0123456789. C 0123456789. D 0123456789. E 0123456789. F 0123456789. G 0123456789. H 0123456789. I 0123456789. J 0123456789. K 0123456789.";

int OnInit() {
        printf("%s", settings);
        return 0;
}

The problem is that the output of the printf is:

"A 0123456789. B 0123456789. C 0123456789. D 0123456789. E 0123456789. F 0123456789. G 0123456789. H 0123456789. I 0123"

in other words, the "settings" parameter is truncated and I need to pass this value as an input to the EA.


Regards, Cyberglassed.

John Townsend
83
John Townsend 2014.06.14 02:52  
cyberglassed:

Hello folks, I have an EA with the following source code.

I pass some configuration through the inputs parameters like bellow:

The problem is that the output of the printf is:

"A 0123456789. B 0123456789. C 0123456789. D 0123456789. E 0123456789. F 0123456789. G 0123456789. H 0123456789. I 0123"

in other words, the "settings" parameter is truncated and I need to pass this value as an input to the EA.


Regards, Cyberglassed.

Other options: Use a second input parameter, use File Functions (FileOpen, FileReadString...) ...

HTH John 

cyberglassed
611
cyberglassed 2014.06.14 07:14  
jftjft:

Other options: Use a second input parameter, use File Functions (FileOpen, FileReadString...) ...

HTH John 

Thank you, I opted for the first option ;)
Engin Topcuoglu
280
Engin Topcuoglu 2014.06.14 10:32  
Thanks, it's interesting.
Alain Verleyen
Moderator
30752
Alain Verleyen 2014.06.14 11:20  
cyberglassed:
Thank you, I opted for the first option ;)

See documentation :

Note: The length of a string comment for Input variables cannot exceed 63 characters.

To add comments, please log in or register