Higher time frame candle direction Text

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #102890 quote
    Stocks008
    Participant
    Average

    Good day,

    I would like to add text on the side of an hourly chart that can tell me if the 4 hour candle is bullish or bearish. I have seen the indicator that draws rectangles of higher time frame candles but I don’t know how to change it so that I can add text.

    On hourly chart the text should say if the 4 hour chart’s close is higher or lower than the open.

    thank you,

    Justin

    #102902 quote
    GraHal
    Participant
    Master

    The information on how to  DRAWTEXT is on the HELP dropdown (top toolbar) under language documentation. 

    A comprehensive example is provided on the link below

    https://www.prorealcode.com/documentation/drawtext/

    #102907 quote
    Stocks008
    Participant
    Average

    I understand how to draw text but where I get confused is how to get 4-hourly data into the code so I can draw text on an hourly chart if you know what I mean?

    I just want the text on the hourly to tell me if the close is <or> than the close but I am not sure where to even start.

    for example: Dopen > dclose but I don’t know how to do it with 4 hour bars.

    How do I go about that?

    #102908 quote
    GraHal
    Participant
    Master

    I have seen the indicator that draws rectangles of higher time frame candles but I don’t know how to change it so that I can add text.

    Post the code here of the Indicator you want Drawtext adding into.

    Above will be easier and quicker for somebody to help you than to try and explain how to do it.

    #102909 quote
    robertogozzi
    Moderator
    Master

    There you go:

    DEFPARAM CalculateOnLastBars = 1000
    DEFPARAM DrawOnLastBarOnly   = true
    h1 = OpenTime MOD 4
    IF h1 = 0 THEN
       h1 = 4
    ENDIF
    h4Open  = open[h1 - 1]
    h4Close = close
    IF h4close > h4Open THEN
       Offset  = highest[h1](high)
       DRAWTEXT("4H candle is BULLISH", BarIndex[h1 - 1], Offset) COLOURED(0,192,0,255)
    ELSE
       Offset  = lowest[h1](low)
       DRAWTEXT("4H candle is BEARISH", BarIndex[h1 - 1], Offset) COLOURED(192,0,0,255)
    ENDIF
    RETURN
    GraHal and Stocks008 thanked this post
    h4-1.jpg h4-1.jpg h4-2.jpg h4-2.jpg
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Higher time frame candle direction Text


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Stocks008 @jd008 Participant
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by robertogozzi
6 years, 6 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 07/19/2019
Status: Active
Attachments: 2 files
Logo Logo
Loading...