Week number

 

Hi,


I'm struggling with the following problem :


I'm trying to program an EA to be able to know which week we are in (value of 1 to 52) and to set a maximal risk for the week based on the equity at the start of the week. Since there is no functions in MQL4 allowing me to do that, I don't know how to start.


Should I get the DayOfWeek (0 - 6) and the date or use the DayOfYear + simple math to determine what week is (ex : day 130 / 7 = week 18th)


I'm open to new ideas.


Thanks

 

I'd just do maths on DayOfYear().

I can understand your need to know when its a new week as part of a money management and risk strategy.

But why do you need to know which particular week?

Interested.


CB