Nicolas

Heikin Ashi of higher timeframes (hourly TF)

Category: Indicators By: Nicolas Created: February 22, 2018, 10:13 AM
February 22, 2018, 10:13 AM
Indicators
16 Comments
Heikin Ashi of higher timeframes (hourly TF)

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/

defparam calculateonlastbars=10000 //increase this number to get more history

// --- settings
TimeframeHeikinAshi = 4 //higher TF number (only hours)
// --- end of settings

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"

 

Download
Filename: PRC_Heikin-Ashi-higher-TF.itf
Downloads: 686
Download
Filename: heikin-ashi-multiple-timeframes.png
Downloads: 314
Nicolas
Nicolas Legend
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
Author’s Profile

Comments

lee
lee
8 months ago
#

Thank you!

TraderGlyn
6 years ago
#

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?

marzibre
7 years ago
#

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

mcha
7 years ago
#

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.

Nicolas
8 years ago
#

A tweaked version which allow to use timeframe in minutes: https://www.prorealcode.com/topic/heikin-ashi-of-higher-timeframes-under-h1/

fabioerliam
8 years ago
#

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

fabioerliam
8 years ago
#

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:)

Nicolas
8 years ago
#

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.

fabioerliam
8 years ago
#

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!

fabioerliam
9 years ago
#

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

Leo
Leo
9 years ago
#

Hi Nicolas, is it not the definition in line 44 like this: Opentf= (opentf+haclose)/2 Cheers

Nicolas
9 years ago
#

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.

cfta
9 years ago
#

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?

Nicolas
9 years ago
#

Yes, that sounds possible, let me think of it.

cfta
9 years ago
#

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.

Nicolas
9 years ago
#

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.

ProRealCode ProRealCode
Loading...