Nicolas

HPT Heikin Ashi Smoothed

Category: Indicators By: Nicolas Created: April 25, 2017, 9:35 AM
April 25, 2017, 9:35 AM
Indicators
39 Comments
HPT Heikin Ashi Smoothed

This trend following indicator is another attempt to filter the noise of the price by using Heikin Ashi candlesticks construction. This one double smoothed the price information by using 2 set of moving average. Of course, it is lagging but it has the capabilities to reduce considerably the market noises. It can also be used to find turning point of the market or a good way to jump into a trend. Someone ask me recently to convert it to prorealtime, so here it is.

The indicator embed 2 external variables (“long” and “short”) that can be used to be imported into trading strategies to launch BUY or SELL orders on market.

 

 

//PRC_HPT Heikin Ashi Smoothed | indicator
//25.04.2017
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
//translated from MT4 indicator code

//---settings
//MaPeriod=6
//MaPeriod2=2
//---end of settings

once maOpen=Open
once maClose=Close
once maLow=Low
once maHigh=High

if barindex>0 then
 maOpen=(maOpen[1]*(MAperiod-1)+Open)/MAPeriod
 maClose=(maClose[1]*(MAperiod-1)+Close)/MAPeriod
 maLow=(maLow[1]*(MAperiod-1)+Low)/MAPeriod
 maHigh=(maHigh[1]*(MAperiod-1)+High)/MAPeriod

 haOpen=(ExtMapBuffer5[1]+ExtMapBuffer6[1])/2
 haClose=(maOpen+maHigh+maLow+maClose)/4
 haHigh=Max(maHigh, Max(haOpen, haClose))
 haLow=Min(maLow, Min(haOpen, haClose))
 if (haOpen<haClose) then
  r=0
  g=191
  b=255
  ExtMapBuffer7=haLow
  ExtMapBuffer8=haHigh
 else
  r=255
  g=10
  b=0
  ExtMapBuffer7=haHigh
  ExtMapBuffer8=haLow
 endif
 ExtMapBuffer5=haOpen
 ExtMapBuffer6=haClose

 ExtMapBuffer1=weightedaverage[MAperiod2](ExtMapBuffer7)
 ExtMapBuffer2=weightedaverage[MAperiod2](ExtMapBuffer8)
 ExtMapBuffer3=weightedaverage[MAperiod2](ExtMapBuffer5)
 ExtMapBuffer4=weightedaverage[MAperiod2](ExtMapBuffer6)
endif
 DRAWCANDLE(ExtMapBuffer3,ExtMapBuffer2,ExtMapBuffer1,ExtMapBuffer4) coloured(r,g,b)

short = ExtMapBuffer7[1]>ExtMapBuffer8[1] and ExtMapBuffer7[2]<ExtMapBuffer8[2] and ExtMapBuffer7[0]>ExtMapBuffer8[0]
long = ExtMapBuffer7[1]<ExtMapBuffer8[1] and ExtMapBuffer7[2]>ExtMapBuffer8[2] and ExtMapBuffer7[0]<ExtMapBuffer8[0]

RETURN long as "long signal", short as "short signal"

 

Download
Filename: PRC_HPT-Heikin-Ashi-Smoothed.itf
Downloads: 1169
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

Ybr35
5 years ago
#

Bonjour Nicolas, lorsque je lance l'indicateur, il m'est indiqué que je dois définir les variables MAPERIOD et MAPERIOD2....pourrais-tu m'aider à ce ce sujet? Merci beaucoup.

Nicolas
5 years ago
#

L'idéal est de télécharger le fichier itf joint sur cette page et de l'importer dans la plateforme pour bénéficier du code complet.

bearbull
6 years ago
#

As per PhilipSchultz question above, has anybody managed to add code for when it turns blue, enter long. And for red enter short?.....I would be very interested in this additional code to the HeikinAshi smooth

PhilipSchultz
6 years ago
#

Hi Nicolas, do you know if I Can backtest this indicator. For example. When it turns blue, enter long. And for red enter short?

Nicolas
6 years ago
#

By learning to code, or by asking for other people to do it for you in the forums.

laitus
7 years ago
#

Bonjour Nicolas et collègues, ¿est-il possible d'appliquer la HAS non pas sur le prix mais, par exemple sur une moyenne mobile? Je sais que sur une plate-forme, vous pouvez mais je ne le trouve pas sur celle-ci. Merci d'avance.

Yvan63
8 years ago
#

Bonsoir, Je ne comprends pas comment la variable HaOpen prend sa première valeur vu que ExtMapBuffer5 n'a pas de valeur au début du programme ?

jwebster2
8 years ago
#

Hi Nicholas.. please ignore previous comment .. as I have located it... !

jwebster2
8 years ago
#

HI Nicholas....Can I use this indicator on 30sec/1min timeframes? Also do you have a simple Heikin Ashi chart I can import into IG pro real time to use in the low time frames for scalping ?

Alexandre AMARY
8 years ago
#

Pardon... "contrairement aux bougies bleues"

Alexandre AMARY
8 years ago
#

Bonjour, Je ne comprends pas pourquoi les bougies rouges n'ont jamais de mèche basse, contrairement aux mèches bleues qui elles disposent de mèches hautes et basses. Est-ce normal ? D'avance merci pour tes éclairages ! Et merci pour ce superbe indicateur Alexandre

Nicolas
8 years ago
#

En effet, déjà discuté et modifié dans ce topic: https://www.prorealcode.com/topic/heiken-ashi-smoothed-code/

ALAM
8 years ago
#

Merci Nicolas, j'ai bien trouvé la version corrigée de l'indicateur. Un grand merci pour ton partage de connaissances sur cette plateforme. Alexandre.

cfta
8 years ago
#

//PRC_HPT Heikin Ashi Smoothed | indicator //25.04.2017 //Nicolas @ www.prorealcode.com //Sharing ProRealTime knowledge //translated from MT4 indicator code //---settings //MaPeriod=6 //MaPeriod2=2 //---end of settings once maOpen=Open once maClose=Close once maLow=Low once maHigh=High if barindex>0 then maOpen=(maOpen[1]*(MAperiod-1)+Open)/MAPeriod maClose=(maClose[1]*(MAperiod-1)+Close)/MAPeriod maLow=(maLow[1]*(MAperiod-1)+Low)/MAPeriod maHigh=(maHigh[1]*(MAperiod-1)+High)/MAPeriod haOpen=(ExtMapBuffer5[1]+ExtMapBuffer6[1])/2 haClose=(maOpen+maHigh+maLow+maClose)/4 haHigh=Max(maHigh, Max(haOpen, haClose)) haLow=Min(maLow, Min(haOpen, haClose)) if (haOpenExtMapBuffer8[1] and ExtMapBuffer7[2]ExtMapBuffer8[0] then indicator1=-1 endif if ExtMapBuffer7[1]ExtMapBuffer8[2] and ExtMapBuffer7[0]<ExtMapBuffer8[0] then indicator1=1 endif RETURN indicator1

cfta
8 years ago
#

Nicolas, what adaptions do we need to make to use this indicator in a strategy code, how do we set the contiditions? I have tried a few variants using "long signal" and "short signal" and also tried to change the code to return indicator with a 1 or -1 value but don't manage to make it work. In addition if using the code for a strategy we can delete all the lines relating to drawing candles instructions to speed up calculations but which ones should we remove?

cfta
8 years ago
#

Thanks Nicolas :) It turned out I needed to remove line 48 but also a few more, earlier I removed either too many or too few but now I got it right and adapted it to a histogram version returning either 1 or -1 (I didn't figure out how to use "long signal" and "short signal" most likely due to my lack of knowledge). Anyway here is the adapted code in case anyone finds it useful;

Nicolas
8 years ago
#

you can remove line 48. Using returned variables 'long signal' and 'short signal' should work in a strategy. When one is true, it returns 1, while it returns 0 if not.

Gennadiy
9 years ago
#

Here is the link to the image: http://ipic.su/img/img7/fs/Candle.1503737934.png

Gennadiy
9 years ago
#

Here is my code: RETURN long as "long signal", short as "short signal", weightedaverage[MAperiod2](ExtMapBuffer7) as "ExtMapBuffer1", weightedaverage[MAperiod2](ExtMapBuffer8) as "ExtMapBuffer2", weightedaverage[MAperiod2](ExtMapBuffer5) as "ExtMapBuffer3", weightedaverage[MAperiod2](ExtMapBuffer6) as "ExtMapBuffer4"

Gennadiy
9 years ago
#

Thank you, very much, Nicolas, for this wonderfull Indicator! I have a question. I have added colored lines to see "ExtMapBuffer1" and others. And i saw, that the short-candle doesn't have "low", that should be becouse of "ExtMapBuffer1"-Line. Shold something be added to the code?

ade1
9 years ago
#

thankyou

ade1
9 years ago
#

Hullo Nicolas,

when i put the indicator on my chart ,it comes as an indicator below the chart like RSI or MACD.How do i put it on the price chart.

Many thanks

Adrian

Nicolas
9 years ago
#

Apply it on price instead with the wrench on the upper left side of the price chart.

leyoy
9 years ago
#

Salut Nicolas, j'ai un petit soucis d'affichage : quand je lance PRT tout le graph est condensé et je suis obligé à chaque fois de jouer avec les bords du graph pour le remettre correctement.
C'est du au long/short signal de ton indicateur représenté par un trait (trait blanc sur le screenshot) : du coup l'ecran de PRT prend en compte le graph + ce trait qui est tres tres tres bas par rapport au prix et donc on a ce condensé au lancement ou au changement d'unité de temps.

Possible de corriger ça ?

Lien image : http://hpics.li/df46769

Merci beaucoup :)

Nicolas
9 years ago
#

Dans les paramètres du prix, tu choisis une mise à l'échelle verticale basée sur le prix uniquement.

leyoy
9 years ago
#

oh yes ... ca marche nickel, je ne connaissais as cette fonctionnalité de PRT. Encore merci :)

denmar
9 years ago
#

Hi Nicolas

Any chance you could please modify the code slightly for me? I would like it if the longer term MA was smoothed (6 periods) and if you could suppress the wicks ie only plot the body.  Thank you.

 

finplus
9 years ago
#

oui bien sûr j'ouvre le sujet immédiatement.

 

finplus
9 years ago
#

Bonsoir. Merci pour code très intéressant. Juste une petite chose : j'utilise également l'indicateur trouvé sur ce site "better bollinger bands". or, il se trouve qu'avec le heikin ashi smoothed, en phase de hausse, les cours se retrouvent sous la courbe centrale et en phase de baisse, les cours se retrouvent sur la courbe centrale. Serait il possible alors d'essayer d'aménager en conséquence l'indicateur "better bollinger bands" afin de trouver une certaine cohérence avec le heikin ashi smoothed? Merci d'avance.

 

Nicolas
9 years ago
#

Forum svp, avec des images pour bien expliquer merci :) 

ProRealCode ProRealCode
Loading...