How to open a pending order at first day of the month
-
Hi guys,
i have been reading and cannot find how can i open a trade at first day of the month - after the first daily candle is closed or at after 18:00 that day - not including Sunday candle.
Let me know which direction i need to go
Much appreciated
Thanks
-
-
thank you - it opens trades at the beginning of the month.
how can i calculate the range of the candle for that day?
-
thank you it work great
-
This is my idea for detecting the real first day and last day of the month: https://fxdreema.com/shared/iB1YvWgSb
The first pair of blocks would print yellow arrows on each candle in the first day. the second pair prints pink arrows on the last day.For newbies, && means AND and || means OR. The whole formula can be written in 1 row only, but I wrote it like this. The condition is asking whether the first row OR the second row is true.
Let's take block 1 for example, the second row:
TimeDay(TimeCurrent()) < TimeDay(TimeCurrent() - 86400)TimeCurrent() gives us the current time of the current candle. This is the server time, not the local time on the PC. This is the number of seconds since 1.1.1970.
By the way there is also function Day() that can replace TimeDay(TimeCurrent()) .
86400 is the number of seconds in 1 day.
TimeDay gives us the current day. Today is 25 for example.
TimeCurrent() - 86400 is 24 hours in the past, so TimeDay(TimeCurrent() - 86400) gives us the day of yesterday. For example 24.
So, what I ask is whether the date today is < the date yesterday. If today is 1 and yesterday is 31 (or 30, or 29), then I detected the first day of the month.The first row:
DayOfWeek() == 1 && TimeDay(TimeCurrent()) < TimeDay(TimeCurrent() - (3 * 86400))DayOfWeek() is the day of the week, where 0 would be Sunday, 1 is Monday.... and 6 is Saturday. So DayOfWeek() == 1 asks if the day is Monday.
The problem is that Monday is not always day 1. Maybe Monday is 3rd. So I compare the Monday's day with last Friday's day.It's all pretty much the same in block 3, but the opposite.
-
thank you for reply i will work on it now
-
hi it works really well - thank you
