Hi all,
Has anyone managed to program a multi-timeframe candle/bar chart where the most current candle is ‘live’ rather than having to wait for it to close?
Many thanks,
Robert
Hi Robert,
Here’s an example of how to create a multi-timeframe candle chart in real-time without waiting for the candle to close. The code accesses the 1-hour candle data and draws it live on the chart:
timeframe(1h) // 1-hour data
liveHigh = high
liveLow = low
liveOpen = open
liveClose = close
if liveClose > liveOpen then
r = 255
g = 255
b = 255
else
r = 255
g = 0
b = 0
endif
drawcandle(liveOpen, liveHigh, liveLow, liveClose) coloured(r, g, b)
return
This code draws the live candle with color adjustments based on whether it’s bullish or bearish. You can modify it to fit your needs.
Thank Ivan for your help, not sure what I am doing wrong but your code seems to return the same as the input TF( if that makes sense)
Hi!
You need open new graph with 1H timeframe to check it.
Thanks, Ivan, So there is no way to have just a single ‘hourly bar’? on a lower TF, Someone ( I can’t find the post) had a go at it but the live candle was somewhat iffy.
No- it was another one, I will have a look for it and update.
Hi Ivan,
This is the code I meant(bottom of page), however, it doesn’t update the current bar, is there any way of getting it to do so? https://www.prorealcode.com/topic/show-5-minute-candlestick-in-1-minute-chart/page/2/
R