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
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/
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?
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.
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