In any case you don't want to be looping back from i to i+n to find the start of the week. A) Time of bar, B) iBarshift to find the W1 bar, C) iTime of the W1 bar, D) ibarshift to find the chart bar at BOW.
I will have to look into OnCalculate to better understand.
thanks again!
aristides.
(MT4 screenshot:)
You're welcome :)
Don't let all the const arrays after OnCalculate distract you. None of those arrays are used in the code. Just concentrate on the logic, you were almost there when you said
"My initial thought was to use (DayOfWeek[0] < DayOfWeek[1]) to find the first day of the week."
Why do you need to change anything? Look at the last lines for the previous week.
I need them. And want them drawn. So that when I apply it to the chart it shows/draws in the current week.. also at newest bar the high low from the previous week.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
aristid:
My initial thought was to use (DayOfWeek[0] < DayOfWeek[1]) to find the first day of the week.
My problem is that I cannot use this on backdata, only realtime.
thanks for your reply, I understand.
My initial thought was to use (DayOfWeek[0] < DayOfWeek[1]) to find the first day of the week.
My problem is that I cannot use this on backdata, only realtime.
There is something I'm not getting with MQL4.
Any suggestions, I'd appreciate.
thanks again.
Try this, it may give you a start.
I think that it should work in real time as well
you seems to be using donchian channel.use that on one week TF and you will see when price close above or below the channel!
GumRai,
thank you very much,
it certainly looks excellent!
I will have to look into OnCalculate to better understand.
thanks again!
aristides.
(MT4 screenshot:)
GumRai,
thank you very much,
it certainly looks excellent!
I will have to look into OnCalculate to better understand.
thanks again!
aristides.
(MT4 screenshot:)
You're welcome :)
Don't let all the const arrays after OnCalculate distract you. None of those arrays are used in the code. Just concentrate on the logic, you were almost there when you said
"My initial thought was to use (DayOfWeek[0] < DayOfWeek[1]) to find the first day of the week."
Try this, it may give you a start.
I think that it should work in real time as well
Could anyone tell me how I can change the indicator by Keith Watford to previous weekly high low ?
Why do you need to change anything? Look at the last lines for the previous week.
Why do you need to change anything? Look at the last lines for the previous week.
You want the previous week's H/L drawn on the current week. That isn't what your code does. It will have to be completely rewritten.
- Update the W1 chart. (One function call at the start)
Download
history in MQL4 EA - MQL4 and MetaTrader 4 -
MQL4 programming forum
- Find the W1 shift for the bar index. (One function call.)
- Get the H/L of the previous W1 bar and store. (Two assignments.)
17 lines become 4.