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"); }
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 ?