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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
//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" |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Congratulations Nicolas for one more briliant indicator, this might become the new favorite indicator for a Heiken Ashi fetischist as myself 🙂 However I’m puzzled regarding how we can easily use as a signal or filter in strategies since it seems tricky to find something for the strategy to differentiate longs from shorts by color, the change is easier to manage but if it is already showing one color and we want to enter a position based on the current color.
Would it be possible to modify the indicator to only return one value and possibly set longs to equal 1 and shorts to equal -1? Hence we can use CROSSES OVER/UNDER 0 for change and >0 or <0 to enter on current signal. What do you think?
I anticipated that question, that’s why I added a variable called ‘signal’ which already gives 1 or -1 when the heikin ashi color change.
As always you’re one step ahead Nicolas. I figured that out on my own yesterday before I noticed your reply.
Another question though, do you think you might be able to find time to creat another version adapted for minutes TFs? Such as running it on m1 showing the Heiken Ashi candle of 5,15 and 30 minutes, combined with the current indicator showing H1 or H4 that can become a very powerful strategy.
Yes, that sounds possible, let me think of it.
Hi Nicolas, is it not the definition in line 44 like this:
Opentf= (opentf+haclose)/2
Cheers
No, because opentf is only used to calculate the haclose at line 53 and we need the real price of when the superior timeframe candlestick is opened.
Hi Nicolas!
thanks for this indicator!
I don’t understand why to indicate the daily timeframe we have to use 1440 and not 24…if it is set in houres it should be 24 to indicate a daily candle…
what I don’t understand?
thanks
Sorry guys…why to indicate the daily timeframe we have to use 1440 and not 24 if this indicator is set in houres? If 1 is for 1houre, 2 is for 2 houres…24 should be for the daily…why I’m wrong? Thanks to the one that can answer!
Hi Nicolas, can you create the same indicator for the heikin ashi smoothed? I’ve tried to create by myself putting the heikin smoothes code after the “if hourecheck then” but It doesn’t work…need help please:)
Please don’t spam the comments. Should be hard because Smoothed Heikin Ashi are made with moving average and without arrays capabilities, it’s tricky.. sorry.
Sorry Nicolas…wasn’t what I was thinking to do…I thought you couldn’t received the notification of the messages if I don’t insert the “#”….anyway thanks for the answer and for the time u dedicate to us!!!!! What about the other question I would like to know? You can see it on the posts above…it’s about why I have to indicate the daily tf with 1440 and instead the one houre with 1….the mtf is express in minite or houres?
Many thanks
A tweaked version which allow to use timeframe in minutes: https://www.prorealcode.com/topic/heikin-ashi-of-higher-timeframes-under-h1/
Bonjour Nicolas
J’ai mis cet indicateur sur une période graphique 1 heure.
J’ai choisi 1 pour 1 heure, 2 pour 2 heures.
Mais que faut-il choisir dans propriétés comme valeur de TimeframeHeikinAshi pour obtenir un indicateur ”daily”. Je n’obtiens qu’un histogramme vert que je choisisse 24 ou 1440 ce qui n’est pas la réalité si on se réfère à un graphe daily avec données Heikin ashi
Je suis en difficulté sûrement pas insurmontable mais je ne sais pas la manœuvre ou l’astuce.
Merci par avance de votre aide.
Bonjour Nicolas.
I work mainly on Daily timeframe. I was looking something similar but using Daily as base timeframe and Weekly and Monthly as superior timeframe.
Do you think is it possible to changes on this ?
Many thanks in advance
This is an excellent indicator, it provides a hugely useful visual interpretation that filters entries well. Thanks for creating it.
I’m finding it particularly useful for scalping the DAX and DOW whilst using a hull ma and HA candles.
One thing I’ve noticed is that the histogram colours change when you vary the units displayed, and that the colours don’t always reflect the actual HA candle colour. Different time frames with the same indi also vary in the way they show higher TF candles.
Is there an optimal units and or time frame for best consistency?