Plotting Daily High and Low only for the last Day

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #71489 quote
    gilad1
    Participant
    New

    Hi,

    I need to plot a horizontal line (on every timeframe’s chart) showing the Daily High and Low for the last trading day (of course it has some meaning only on lower timeframes than the Daily).

    Thanks a lot for your assistance,

    Gil.

    #71497 quote
    robertogozzi
    Moderator
    Master

    I moved your topic to the english forum, instead of the french one.

    #71510 quote
    Nicolas
    Keymaster
    Master

    Not tested, but it could be something like this:

    defparam drawonlastbaronly=true
    
    if intradaybarindex=0 then 
     first=barindex
    endif
    
    drawsegment(first,dlow(1),barindex,dlow(1))
    drawsegment(first,dhigh(1),barindex,dhigh(1))
    
    return
    #71512 quote
    robertogozzi
    Moderator
    Master

    Nicolas, it works everyday but on monday, since on monday it refers to weekend data.

    I arranged this code to account for mondays, unless someone WANTS to refer to we data, in that case your code is fine (or my code won’t need the OpenDayOfWeek test).

    DEFPARAM DrawOnLastBarOnly   = True
    IF OpenDayOfWeek = 1 THEN           //one more day to look back on Monday
       PastBars = 2
    ELSE
       PastBars = 1
    ENDIF
    IF IntraDayBarIndex = 0 THEN
       x = Dhigh(PastBars)
       y = Dlow(PastBars)
    ENDIF
    DRAWHLINE(x) coloured(0,255,0,255)
    DRAWHLINE(y) coloured(255,0,0,255)
    RETURN
    Nicolas thanked this post
    #71518 quote
    gilad1
    Participant
    New

    Many thanks Roberto and Nicolas, I appreciate it !

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

Plotting Daily High and Low only for the last Day


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
gilad1 @gilad1 Participant
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by gilad1
7 years, 8 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 05/28/2018
Status: Active
Attachments: No files
Logo Logo
Loading...