Hello PRT experts,
Is it possible to combine a series of candles from a 1Hr chart to create our own candlestick chart?
Please note that this is different than using a different timeframe to achieve same, because in PRT the timezone is set and can only be altered globally and not individually.
For example, I want to combine the last 4 bars on a 1Hr chart together and draw them as a single bar. Note this is different than simply looking at 4hr chart (every 1 bar) or 15min chart (every 4 bars).
I would appreciate any expert input.
Stay Safe and my best regards
There can’t be holes in between candles, so you will have to:
- use DRAWCANDLE to plot a white candle so that the original one (almost) disappears
- use DRAWCANDLE to plot, in the 4th hour’s place, the combined OHLC values, the lowest LOW, the highest HIGH, the first OPEN, the last CLOSE.
Try this (not tested):
DRAWCANDLE(Open,High,Low,Close) COLOURED(255,255,255,255) BORDERCOLOR(255,255,255,255)
If openhour MOD 4 = 0 then
O4 = open
H4 = high
L4 = low
Endif
H4 = max(high,H4)
L4 = min(low,L4)
If openhour MOD 4 = 3 then
C4 = close
DRAWCANDLE(O4,H4,L4,C4)
Endif
RETURN
This is slightly better:
Size1 = 1.01
Size2 = 0.99
DRAWCANDLE(High*Size1,High*Size1,Low*Size2,Low*Size2) COLOURED(255,255,255,255) //BORDERCOLOR(255,255,255,255)
If (openhour MOD 4 = 0) OR (IntraDayBarIndex = 0) then
O4 = open
H4 = high
L4 = low
Endif
H4 = max(high,H4)
L4 = min(low,L4)
If openhour MOD 4 = 3 then
C4 = close
DRAWCANDLE(H4*Size1,H4*Size1,L4*Size2,L4*Size2) COLOURED(255,255,255,0) //BORDERCOLOR(255,255,255,255)
r = 255
b = 0
IF C4 > O4 THEN
r = 0
b = 255
ENDIF
DRAWCANDLE(O4,H4,L4,C4) coloured(r,0,b,255)
Endif
RETURN