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
You must be logged in to post a comment.
Hi Pableitor, Nicolas, I was wondering if you could help me with one doubt I have on this higher timeframe HA, its a bit difficult to explain but if you paste it in the code and see the chart you will probably understand . If you plot , after return, " haopen as "haopen", y2 as "y2" " you can get plain multitimeframe (MTF) values of HAopen and haclose (this one 1 period ago = haclose[1]). I cant understand why if one writes "haclose[1]" instead of "y2" the chart is different, but the question is, how can one get the haclose[0] in a chart but being a straight line for the period selected as MTF, like haopen and y2 before? Thanks/Merci
Hi All, I am not very knowledgeable with coding. I have tried to add this indicator and get the following message - Syntax error: The following variable is undefined: timeframehaminutes. I would really appreciate it if someone could tell me what I need to do to fix this. Thank you Corinne
Merci Nicolas de la rep oui bien sur que le prix a une position identique le but est d'avoir tout sur un seul graph (plus hauts + bas par unité de temps )
Il doit être possible tout simplement d'emprisonner les bougies dans des rectangles (+haut +bas et UT) d'unité de temps supérieures je ne saurais pas le coder donc ..... ex sur graph 5M rectangles pour les UT 15M H1 D1 d'un seul coup d'oeil cela permettrait de visualiser l'amplitude et la position du prix sur chaque UT ainsi que la tendance de fond et celle du moment cordialement
Thanks Nicolas, I didnt know there was a multitimeframe support now... I will check it. This code was splendid although I have never been able to plot the close as a straight line. Can you suggest an indicator like this in the new PRT version, please? thx vm