OldZ posted # :
it is easy to get weekly open time with any daily open time in MT4
eg:
datetime t1= iTime(NUll,Periond_D1,i); // i is the bar index of Daily chart
int index=iBarshift(NUll.PERIOD_W1,t1); // here ,we can use t1 as "open time" of the weekly bar
datetime t2= iTime(Null,Periond_W1,index); // here t2 is realy open time of weekly bar.
it means that we can any day within a week to calculate the weekly open time,
But now how to do calculation like this in MT5 ?
try this
datetime BarOpenTime[1]; datetime DayInWeek=D'2010.05.15'; if(CopyTime(_Symbol,PERIOD_W1,DayInWeek,1,BarOpenTime)==1) { Print("Beginning of week containing date",TimeToString(DayInWeek),"is",TimeToString(BarOpenTime[0])); } else { Print("Problem obtaining time data"); }
tested,OK.
2010.05.22 23:53:12 test (EURUSD,W1) Beginning of week containing date 2010.05.15 00:00 is 2010.05.09 00:00
Thank you ,phampton !
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
it is easy to get weekly open time with any daily open time in MT4
eg:
datetime t1= iTime(NUll,Periond_D1,i); // i is the bar index of Daily chart
int index=iBarshift(NUll.PERIOD_W1,t1); // here ,we can use t1 as "open time" of the weekly bar
datetime t2= iTime(Null,Periond_W1,index); // here t2 is realy open time of weekly bar.
it means that we can any day within a week to calculate the weekly open time,
But now how to do calculation like this in MT5 ?