datetime to string

Back to topics list To post a new topic, please log in or register
avatar
58
Chistabo 2016.07.06 21:43
 

Hi!

I am, obviously unsuccessfully, trying to paste datetime into string:

datetime dt_EAExpires=D'2016.12.31 23:59';
extern string EA_expires_txt="--- EA expires on: "+TimeToString(dt_EAExpires,TIME_DATE|TIME_MINUTES)+" ---"; /*2016.12.31 23:59 ---";*/ // --- EXPIRATION DATE ---

 This raises an error: '+' - constant expected OmChi EA.mq4 76 101

Adding 'const' before datetime does not solve the issue.

Please advise.

 

Thank you,

 Best regards,

 

Simon

S love nia 

EDIT: it looks like this will not work - ever, since I am trying to process data before initialization (at compile time?).

 

avatar
1215
FMIC 2016.07.07 01:47 #
 

You cannot use variable expressions (such as calls to functions) when setting the initial value of an "extern" or "input" variable/parameter. They are presented to the user before execution begins, so they have to be of a constant nature.

You can however, change the value of "extern" parameters within the EA execution, such as in the OnInit() or OnTick(), but you cannot change "input" variables.

Back to topics list  

To add comments, please log in or register