
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 guys.
I am not a coder and I need some help...
My question is about how can I capture an hour with minutes as a constant data. I have tried by some ways but I can not to do it.
Mi intention is to compare the constant data with the open time of the bar in order to obtain if that bar is in a sesion of Tokyo, or in a sesion of London, or in the two sesions, etcetera.
These two lines are wrong, according to the compiler:
datetime SydneyBegin = D'00:00';// Open Australia Session
string SydneyEnd = D'09:00:00';// Close Australia Session
I know that I can try with something like this:
extern int SydneyBegin = "00:00";
extern int SydneyEnd = "09:00";
but, I want to be able to compare the constant (the hour independent of the day) to the open time of the bar. This is the lines I am writing to compare the data:
for(int i=limit-1; i>=0; i--)
{
datetime BarTime = iTime(NULL, 0, i);
if(BarTime>=SydneyBegin && BarTime<=SydneyEnd) Sydney[i]=1;
if(BarTime>=TokyoBegin && BarTime<=TokyoEnd) Tokyo[i]=2;
if(BarTime>=LondonBegin && BarTime<=LondonEnd) London[i]=3;
if(BarTime>=USABegin && BarTime<=USAEnd) USA[i]=4;
}
Compilation says:
'00:00' - date literal string is incomplete C:\Program Files\FXDD - MT41\experts\indicators\##_amb_Panel_i-Sessions.mq4 (28, 24)
'09:00:00' - date literal string is incomplete C:\Program Files\FXDD - MT41\experts\indicators\##_amb_Panel_i-Sessions.mq4 (29, 27)
How can I have a constant of the hour, for example 03:00:00? I want that the data hour could be independent of the data day, because always it is the same hour to start the sesion.
Thanks for your atention.
gus