How to initialize extern datetime with current time?

 

Hy guys...

There is a way to initialize an external datetime variable with the current time ?

 

I'm try something like this: 

extern datetime fundamental = TimeCurrent();

 

But returns me the following error: 'TimeCurrent' - constant expected

 

I need to show the current time, not  1790.01.01 00:00

 

Declare the variable Globally, then give it the value in init.

Be aware though, if the EA/indicator is attached to a chart when starting MT4, TimeCurrent may be wrong.

 
GumRai:

Declare the variable Globally, then give it the value in init.

Be aware though, if the EA/indicator is attached to a chart when starting MT4, TimeCurrent may be wrong.

I need it just to show an actual date on Indicator properties window, not oldest date... run it as you say still show 1970.01.01 00:00 on the properties page. See:

 

 

Sorry, I misunderstood. You want to be able to change it?

I don't think it's possible to have it default to TimeCurrent() 

 
wemersonrv:

I need to show the current time, not  1790.01.01 00:00

Wow, I didn't know they had the capacity to count time with computers back in 1790.
 
I just need to show the TODAY time on properties... it's boring select the right date, because every time the indicator is added on graphic, it's shows 1970 date... not today
 
wemersonrv:
I just need to show the TODAY time on properties... it's boring select the right date, because every time the indicator is added on graphic, it's shows 1970 date... not today
Select for what?
 
wemersonrv:
I just need to show the TODAY time on properties... it's boring select the right date, because every time the indicator is added on graphic, it's shows 1970 date... not today
Explain why it is so important to have today's date and someone may be able to help you with a work_around
 
GumRai:
Explain why it is so important to have today's date and someone may be able to help you with a work_around

As an user, i hate it... just imagine 10 datetime fields that you need to change all of them manually from 1970 to now... 

 

As an developer, Thinking in a good user experience, i think if i solve this issue will be a good idea to make the users more happy

 

 

Sorry for my bad english! Using google translator! 

 
wemersonrv: I just need to show the TODAY time on properties... it's boring select the right date, because every time the indicator is added on graphic, it's shows 1970 date... not today
extern string begin = "TODAY"; // YYYY.MM.DD [HH:MM]

datetime when = (date == "TODAY") TimeCurrent() : StringToTime(begin);
 
WHRoeder:

Not works like that, because TODAY is only an example... user can select  any datetime, starting from NOW to future dates... 
Reason: