Horizontal Line On Previous Candle High & Low

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #231109 quote
    Andre36
    Participant
    New

    Hi all! May I ask someone to kindly code me an indicator that shows a horizontal line from the previous daily candle high and low. I’ve seen various codes for highs and lows of daily timeframes but I’m after a horizontal line from the previous daily candle itself (not the timeframe) to the current day

    I’ve been looking through the forum to find what I thought must be a request or feature by someone but…nope!

    Can someone help with this for me please?

    I’ve attached a screenshot of what I’m trying to describe.

    image_2024-04-05_152048282.png image_2024-04-05_152048282.png
    #231115 quote
    robertogozzi
    Moderator
    Master

    There you go:

    DEFPARAM DrawOnLastBarOnly = true
    Timeframe(Daily,UpdateOnClose)
    lowD  = low
    highD = high
    //
    timeframe(default)
    ONCE StartBAR = BarIndex
    IF (lowD <> lowD[1]) OR (highD <> highD[1]) THEN
       StartBAR = BarIndex
    ENDIF
    DrawSegment(StartBAR,highD,BarIndex + 1,highD) coloured("Cyan") style(line,4)
    DrawSegment(StartBAR,lowD, BarIndex + 1,lowD)  coloured("Cyan") style(line,4)
    RETURN
    Andre36 thanked this post
    #231122 quote
    Andre36
    Participant
    New

    There you go:

    Bless you, thanks Roberto, I’ve applied it but its showing the current high and low, not the previous candle. Can you adjust it for me please?

    image_2024-04-05_162441615.png image_2024-04-05_162441615.png
    #231132 quote
    robertogozzi
    Moderator
    Master

    Replace lines 3-4 by:

    lowD  = low[1]
    highD = high[1]
    Andre36 thanked this post
    #231136 quote
    Andre36
    Participant
    New

    You are appreciated! Thank you!

    Replace lines 3-4 by:

    I guess you can tell I’m not good with coding. This is much appreciated. Enjoy your weekend. Thank you!

    #231158 quote
    Andre36
    Participant
    New

    My lines weren’t prepositioned at low and close so Just to let any one else interested in this code know, I replaced the 1’s with 0’s. The original code is just as useful for lower timeframes and reading price but you can essentially do the same thing with the final code. Thanks so much once again.

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

Horizontal Line On Previous Candle High & Low


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Andre36 @andre36 Participant
Summary

This topic contains 5 replies,
has 2 voices, and was last updated by Andre36
1 year, 11 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 04/05/2024
Status: Active
Attachments: 2 files
Logo Logo
Loading...