OHLC Y M W D H4 H1 Last Bar indicator minor fix

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #127440 quote
    Vonasi
    Moderator
    Master

    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.

    OHLC-Y-Q-M-W-D-H4-H1-Last-v1.1.itf
    #130566 quote
    crolakstrading
    Participant
    Senior

    Hi @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!

    #130570 quote
    Vonasi
    Moderator
    Master

    Yes – 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.

    #130574 quote
    crolakstrading
    Participant
    Senior

    ahh ok, thanks for the clarification! weekly lines are shown on Daily, 4h, and 1hr perfectly. it’s just only on the weekly!

    #130580 quote
    Vonasi
    Moderator
    Master

    I 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.

    #130595 quote
    robertogozzi
    Moderator
    Master

    I 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).

    #130610 quote
    Vonasi
    Moderator
    Master

    DAY 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.

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

OHLC Y M W D H4 H1 Last Bar indicator minor fix


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Vonasi @vonasi Moderator
Summary

This topic contains 6 replies,
has 3 voices, and was last updated by Vonasi
5 years, 9 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 04/22/2020
Status: Active
Attachments: 1 files
Logo Logo
Loading...