hi
i have a zig zag indicator that iv modified to draw trendline on each top and bottom to the right over a specific number of bars , , but with one problem . the trend line seem to be short when there are a holiday (Saturday and Sunday )….the code are attached and a picture which show the problem
p.s 1.( the problem seem to be in future and current bars as i notice that there are no short trendlines in the past bars).
2. this part is my modification on the code:
any help is appreciated and thanks
You need your code to take weekend days into account. There are few market hours on Saturday and Sunday, but PeriodSeconds() doesn't know that.
You can either incorporate Sunday bars into Monday or specifically omit trendlines on Saturday/Sunday by using DayOfWeek() as a filter:

You can either incorporate Sunday bars into Monday or specifically omit trendlines on Saturday/Sunday by using DayOfWeek() as a filter:
hi
thanks for your help: i have a question befor traying DayOfWeek() function.
you said: either incorporate Sunday bars into Monday:
1.what about Saturday?
am asking you because am not a programmer but traying to write some simple code
thanks for you
Ryan L Johnson #: I don't see any price data on Saturday in my platform
so I must take in to consideration adding to days to my code 86400x2 second ........as I understand the idea
thanks for you

- 2025.02.04
- abd-
- www.mql5.com

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hi
i have a zig zag indicator that iv modified to draw trendline on each top and bottom to the right over a specific number of bars , , but with one problem . the trend line seem to be short when there are a holiday (Saturday and Sunday )….the code are attached and a picture which show the problem
p.s 1.( the problem seem to be in future and current bars as i notice that there are no short trendlines in the past bars).
2. this part is my modification on the code:
any help is appreciated and thanks