This indicator is based on an idea of Nicolas (= heikin ashi of higher TF ), with the difference that the Heikin Ashi candles of a higher time-frame are now superimposed on the price window of a given TF. Heikin Ashi candles are wonderful to filter the noise in the quotes and allow to see more clearly the underlying trend.The period of the upper TF candles are set in minutes (1 Hour 60, 4 hours 240, one day 1440 etc.)The HA candle is drawn as a rectangle and inside the rectangle we can see next to the price bars other small bars that show us how the HA candle of the TF has evolved over time.
//Higher TF HA candles by pableitor 2018
// --- settings
// TimeframeHAminutes = 60 //higher TF minutes
// --- end of settings
defparam calculateonlastbars=3000 //increase this number to get more history
opd= openday
if (openhour = 0) then
opd = openday + 1
endif
once hightf = 0
once lowtf = close * 100
once ha=0
Myminutes = opd*1440 + openhour*60 + openminute //total minutes since beginning of chart
if (myminutes MOD TimeframeHAminutes < myminutes[1] MOD TimeframeHAminutes ) then //new HA candle
opentf = open
hightf = 0 //fake high
lowtf = close * 100 //fake low
haopen =( haopen[1]+haclose[1])/2
hastart = barindex // position of new candle
x1=hastart[1]
x2=barindex[1]
y1=haopen[1]
y2=haclose[1]
DRAWSEGMENT(x1,y1,x2,y1)coloured(r,g,0)
DRAWSEGMENT(x1,y1,x1,y2)coloured(r,g,0)
DRAWSEGMENT(x1,y2,x2,y2)coloured(r,g,0)
DRAWSEGMENT(x2,y1,x2,y2)coloured(r,g,0)
ha=1 // flag for first HA candle
endif
hightf = max(hightf,high)
lowtf= min(lowtf,low)
if ha = 0 then
opentf = open //fake value when theres no HA candles
endif
if ha=0 then
haopen = open
endif
haclose=(opentf+close+lowtf+hightf)/4
r=0
g=200
if haclose<haopen then
r=200
g=0
endif
DRAWCANDLE(haopen,haopen,haclose,haclose) COLOURED(R,G,0,40) BORDERCOLOR(R,G,0,40)
return