Hi,
is there an elegant way to trade e.g. every 5th week and on different days (e.g. Tuesday in week 1, Thursday in week 6,...). I tried it with something like
if(week(0)%5 == 1) {...}
which works for one year, but if the script moves on to the next year this does not work propperly, as it trades in week 51 of the current year and then again in week 1 of the next year. Using the Bar number directly also does not work properly, because of missing trading day (holidays etc.).
Also, I only want to trade once per week, so if I am in the right week I can select Tuesday with dow(0)==2, but if I also have a condition for Thursday, it would also trad Thursday that week. Do I then have to flag it with something like
boolean tradedThisWeek = True;
and toggle that accordingly? Or is there an easier, more elegant way to do this?