Plotting Daily High and Low only for the last Day

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #71489 quote
    gilad1gilad1
    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
    robertogozzirobertogozzi
    Moderator
    Legend

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

    #71510 quote
    NicolasNicolas
    Keymaster
    Legend

    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
    robertogozzirobertogozzi
    Moderator
    Legend

    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
    gilad1gilad1
    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.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

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 gilad1gilad1
8 years, 3 months ago.

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