OHLC Y M W D H4 H1 Last Bar indicator minor fix
Forums › ProRealTime English forum › ProBuilder support › OHLC Y M W D H4 H1 Last Bar indicator minor fix
- This topic has 6 replies, 3 voices, and was last updated 4 years ago by Vonasi.
-
-
04/22/2020 at 12:39 PM #127440
Thanks to crolakstrading for spotting an issue with my ‘OHLC Y Q M W D H4 H1 Last Bar’ indicator when displaying the H4 OHLC lines.
I have fixed the code and attached the updated version here. I will post a comment on the library post directing people to here.
05/08/2020 at 9:44 AM #130566Hi @vonasi,
Sorry to come back to this all over again. it has the same issue on the weekly. if on the weekly chart that doesn’t plot the lines only on the weekly.. i really try to fix it but impossible for me to do!! I think everything else is perfect!
05/08/2020 at 10:09 AM #130570Yes – weeks in PRT can be a challenge because there is no instruction for weeks such as OPENWEEK or WEEK so we can only know that a new week has started if we compare OPENDAYOFWEEK to OPENDAYOFWEEK[1] and it is lower. On a weekly chart every bar starts with an OPENDAYOFWEEK value of zero so it never identifies that a new week has started.
I have not come up with a solution for this other than perhaps trying to add some time frame recognition code…. I’ll have to have a think about it.
05/08/2020 at 10:15 AM #130574ahh ok, thanks for the clarification! weekly lines are shown on Daily, 4h, and 1hr perfectly. it’s just only on the weekly!
05/08/2020 at 10:42 AM #130580I notice that it can also get confused and sometimes draw weekly lines on monthly charts due to the fact that have no way apart from checking the day of the week to know if a week has started or not. I really have not got a solution for it at the moment.
05/08/2020 at 11:16 AM #130595I think you can tell if a new week has started when OpenDay > OpenDay[1] (you might want to use DAY, instead) OR when it’s lower but Month <> Month[1] (not tested, just guessing).
05/08/2020 at 12:50 PM #130610DAY or OPENDAY just returns a number from 1 to 31 for the day of the month so that being higher tells us only that it is a new day unless it is the last day of the month. If it is lower it tells us it is a start of a month but we want to know if it is a start of a week!
OPENDAYOFWEEK < OPENDAYOFWEEK[1] is what I use in the code but on a weekly chart every bar has the same value. Also on a monthly chart random bars will meet this condition too.
-
AuthorPosts