This indicator displays the colors of the heikin ashi candles of the higher timeframe (to be chosen with the “TimeframeHeikinAshi” parameter) under the price graph in a separate window.
In the example we display the HeikinAshi candle colors of timeframes H1, H4 and Daily. The indicator is only compatible with in hours format units, the possible parameters are:
1 = H1
2 = H2
etc.
1440 = Daily (D1)
etc.
At each new bar detected, the indicator displays a vertical bar of gray color.
With each change of color of the heikin ashi bar of the higher timeframe, a “signal” (black histogram) is displayed, this allowing you to recover the information for the creation of an automatic trading strategy for example. It is therefore possible to recover all the changes of direction of each candlestick that took place inside it without waiting for the Close.
//PRC_Heikin Ashi higher TF | indicator
//22.02.2018
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
//https://www.prorealcode.com/topic/heikin-ashi-4-hours-in-a-1-minute-timeframe/
// --- settings
TimeframeHeikinAshi = 4 //higher TF number (only hours)
// --- end of settings
defparam calculateonlastbars=10000 //increase this number to get more history
once NbBar = 1
MyDay=openday
dayminutes = 1440*(MyDay-MyDay[1])
MyHour=openhour
hourminutes = 60*(MyHour-MyHour[1])
MyMin=openminute
barminutes = MyMin - MyMin[1] + hourminutes + dayminutes
barminutes=abs(barminutes)
Mybarminutes = lowest[max(1,NbBar)](barminutes)[1]
//check hours
hourcheck=0
i=0
if MyBarMinutes>=59 then
hourtest=openhour
go=1
else
hourtest=hour
go=0
endif
if minute=MyBarminutes or go then
while i<1440 do
if(hourtest=i) then
hourcheck=1
break
endif
i=i+TimeframeHeikinAshi
wend
endif
if hourcheck then
opentf=open
hightf=0
lowtf=close*100
haopen=(haopen[1]+haclose[1])/2
drawvline(barindex)coloured(100,100,100)
//drawtext("#haopen#",barindex,1.1)
endif
hightf = max(hightf,high)
lowtf= min(lowtf,low)
haclose=(opentf+close+lowtf+hightf)/4
r=0
g=200
if haclose<haopen then
r=200
g=0
endif
if haclose>haopen and haclose[1]<haopen[1] then
signal=0.1
elsif haclose<haopen and haclose[1]>haopen[1] then
signal=-0.1
else
signal=0
endif
return 1 coloured (r,g,0) style(histogram) as "HeikinAshi higherTF color", signal style(histogram) as "HeikinAshi higherTF change"