Day of month filter
-
Hi, I am trying to think of how to program a filter that will block trades on the first friday of each month, but keep trading the rest of the fridays.
I was thinking something like...if (day of month <= 7) and if(weekday == friday)
then trading = inactiveelse
trading = activeI see the weekday filter, but none for the day of the month. Any advice?
thanks
-
Perhaps I could use hours filter in combo with the weekday filter?
i.e. if hours from start of month <=168 && if weeday == friday)
no tradeelse trade??
would this work?
I would need to make a variable for the time at the start of each month
-
Is the first day of teh month the only one to be blocked? Why then are Fridays excluded?
-
No, I want the first friday of the month to be blocked. all other days are OK
-
Anyone have any idea?
-
@nmbruno mql4 documentation is often helpful

https://docs.mql4.com/dateandtime/monthPut Month() into a variable once a week (once a bar, period 1W) and when Month() is != than that variable, new month must have been started
-
@roar oh, now that I think of it, this may be easier done with that once per bar trick
-
But what about the fridays?
-
@l-andorrà there's a weekday filter, as he said
-
Hey, I know this post is old, but I found a simple solution which I want to share - If you want to prevent trading on the non-farm payroll day, or first Friday of the month, use these two time filters together:
Time filter, specify day start and finish, AND weekday filter, allow Friday. So if both these conditions are true, then you can link them to exclude from trading. It should only exclude Friday which falls on day 1 to 7 of the month.
I'm pretty sure this is working now
