Draw Weekly open price on chart

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #135637 quote
    ck1066
    Participant
    Average

    Hi,

    I want to draw a horizontal line of the weekly open price as a horizontal line and a vertical line each Monday (my opening day of the week) on a chart. I’ve looked and can’t see how I can get the opening weeks value to draw using DRAWHLINE.

    Any help would be grateful.

    #135645 quote
    robertogozzi
    Moderator
    Master

    There you go (not tested):

    IF OpenDayOfWeek = 1 AND OpenDayOfWeek[1] <> 1 THEN
       DRAWVLINE(BarIndex) coloured(255,0,0, 255)     //RED   vartical line
       DRAWHLINE(open)     coloured(0,128,0, 255)     //GREEN horizontal line
    ENDIF
    RETURN
    #135665 quote
    Vonasi
    Moderator
    Master

    Using DRAWHLINE will result in a mass of lines across your chart.

    Better to use DRAWSEGMENT like this

    if opendayofweek = 1 and opendayofweek[1] <> 1 then
    myopen = open
    drawvline(barindex) coloured(255,0,0, 255) 
    endif
    
    if myopen = myopen[1] then
    drawsegment(barindex,myopen,barindex-1,myopen) coloured(0,128,0, 255) 
    endif
    return
    robertogozzi and NeoTrader thanked this post
    #139638 quote
    ck1066
    Participant
    Average

    Thanks guys for your assistance. Sorry for the late response.

    #254992 quote
    Philippe
    Participant
    New

    Hello,

    Best wishes for 2026.

    Is there a way to get it for weekly close too ?

    I tried to draw that segment on the previous week close, in vain. I am really not good as this language …

    Thanks in advance.

    #254993 quote
    robertogozzi
    Moderator
    Master

    This version is updated for the previous week CLOSE:

    if opendayofweek = 1 and opendayofweek[1] <> 1 then
       myclose = close[1]
       drawsegment(barindex,myclose,barindex+1,myclose) coloured(0,128,0, 255) 
    endif
     
    if myclose = myclose[1] then
       drawsegment(barindex,myclose,barindex-1,myclose) coloured(0,128,0, 255) 
    endif
    return
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Draw Weekly open price on chart


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
ck1066 @ck1066 Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by robertogozzi
1 month ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 06/11/2020
Status: Active
Attachments: No files
Logo Logo
Loading...