Heikin-Ashi candle smoothed TOPIC
Forums › ProRealTime English forum › ProBuilder support › Heikin-Ashi candle smoothed TOPIC
- This topic has 9 replies, 2 voices, and was last updated 1 month ago by D.trading.
-
-
07/08/2018 at 8:24 PM #75608
Hello
this Topic is to ask more informations about Heikin-Ashi candle smoothed
You can use this indicators in different ways
- Moving Average
- Range area
- Filtered area of market movement
You can set :
- Average period of candle=HeikinPeriod
- Average Type (simple,exponential,triangular, etc) = AverageType
- Average period of impression channel (Highest/Lowest) = ChannelPeriod
- Transparency of the candle =Transparency
Heikin-Ashi candle smoothed123456789101112131415161718192021222324252627282930313233343536//ALE - 28.06.2018//@PROREALCODE///////////HeikinPeriod =40//AverageType =5//ChannelPeriod=10//TransParency =15/////////IF BarIndex=0 THENxClose = (open+high+low+close)/4xOpen = openxHigh = highxLow = lowELSExClose = (open+high+low+close)/4xOpen = (xOpen[1]+xClose[1])/2xHigh = Max(max(high, xOpen), xClose)xLow = Min(min(Low, xOpen), xClose)endif//Smoothed Heikin-Ashixxclose=Average[max (1,HeikinPeriod),AverageType](xclose)xxOpen = Average[max (1,HeikinPeriod),AverageType](xOpen)xxHigh = Average[max (1,HeikinPeriod),AverageType](xHigh)xxLow = Average[max (1,HeikinPeriod),AverageType](xLow)//Colour SettingMyDi = xxclose-xxclose[1]r=50+(200-MyDi*100)g=50+(200+MyDi*100)b=50+(0+MyDi*30)//Build channel with Highest and Lowest of Heikin-Ashi smoothed candleDRAWCANDLE(xxOpen, highest[max(1, ChannelPeriod)](xxHigh), lowest[max(1, ChannelPeriod)](xxlow), xxClose) Coloured (R,G,b,MAX(50,Transparency*10))Return07/09/2018 at 10:15 PM #7568307/10/2018 at 4:51 AM #7568803/30/2020 at 11:40 AM #123918Hello
I have updated the code .
Now it will be possible to choose whether the candles will have a variable color, or a fixed color: green and red.
I also fixed the variable color problem, so now it works on any market and time frame.In the attached files you will find:
– Infographics
– Heikin-Ashi candle smoothed “CODE” to import in your platformRegards
Ale04/20/2020 at 12:27 PM #127052Hi,
Thank for this code. I’m very fan of it.
I’m trying to use it building a probacktest but it’s not accepted by Prorealtime. The error displayed is that the is ‘NO value’.
When I try to add it on the same graph as the price or calling it on the code, I’ve also an error asking to : declare a value for it. Any idea how to fix that?
Regards,
Alain
04/20/2020 at 1:14 PM #127075The indicator returns nothing, while at line 7 you expect a value to be assigned to C1.
1 user thanked author for this post.
04/20/2020 at 1:35 PM #127083Hello Alain,
The code has no values, a candle is drawn only.
In the code below you will find the values you are looking for:Heikin_candle_volume_with_Values123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354//ALE - 28.06.2018//update -30.03.2020//@PROREALCODE///////////HeikinPeriod =40//AverageType =5//ChannelPeriod=10//TransParency =15//ColouredCandle= 0-1 on/off/////////IF BarIndex=0 THENxClose = (open+high+low+close)/4xOpen = openxHigh = highxLow = lowELSExClose = (open+high+low+close)/4xOpen = (xOpen[1]+xClose[1])/2xHigh = Max(max(high, xOpen), xClose)xLow = Min(min(Low, xOpen), xClose)endif//Smoothed Heikin-Ashixxclose=Average[max (1,HeikinPeriod),AverageType](xclose)xxOpen = Average[max (1,HeikinPeriod),AverageType](xOpen)xxHigh = Average[max (1,HeikinPeriod),AverageType](xHigh)xxLow = Average[max (1,HeikinPeriod),AverageType](xLow)IF ColouredCandle then//Colour SettingMyDi = xxclose-xxclose[1]MyDi=MyDi*(1/pointsize)r=50+(200-MyDi*100)g=50+(200+MyDi*100)b=50+(0+MyDi*30)ELSEIF xxClose>xxOpen thenR=0G=255B=0ELSER=255G=0B=0ENDIFENDIFif range>0 thenAVGr=Average[channelperiod](range)endif//Build channel with Highest and Lowest of Heikin-Ashi smoothed candleDRAWCANDLE(xxOpen, (xxHigh+(xxHigh-xxlow)/2)+avgr, (xxlow-(xxHigh-xxlow)/2)-avgr, xxClose) Coloured (R,G,b,MAX(50,Transparency*10))return xxOpen coloured (255,255,255,0) as "open",(xxHigh+(xxHigh-xxlow)/2)+avgr coloured (255,255,255,0) as "high",(xxlow-(xxHigh-xxlow)/2)-avgr coloured (255,255,255,0) as "low",xxClose coloured (255,255,255,0) as "close"12345ignored, HHigh, ignored, ignored = CALL "Heikin_Candle_smoothed"[40, 5, 10, 15, 0]c1 = (HHigh> close)ignored, ignored, LLow, ignored = CALL "Heikin_Candle_smoothed"[40, 5, 10, 15, 0]c2 = (LLow< close)Thanks
Ale1 user thanked author for this post.
10/17/2024 at 10:43 AM #239133Loving the smoothed Heikin-Ashi indicator Ale.
I’m trying a variant of the same indicator where the Heikin-Ashi is ‘smoothed’ using an EMA before & after calculating the Heikin-Ashi.
Here is my code:
Smoothed Heiken Ashi indicator code12345678910111213141516171819202122232425262728/* Variables (defined as Indicator Variables)len = 20len2 = 20*/// First smoothing using EMAopen1 = ExponentialAverage[len](open)close1 = ExponentialAverage[len](close)high1 = ExponentialAverage[len](high)low1 = ExponentialAverage[len](low)// Generating the Heikin Ashi candleshaClose = (open1 + high1 + low1 + close1)/4IF BarIndex = 0 THENhaOpen = ROUND((open1 + close1) / 2, 2)ELSEhaOpen = ROUND((haOpen[1] + haClose[1]) / 2, 2)ENDIFhaHigh = Max(Max(high1, haOpen), close1)haLow = Min(Min(low1, haOpen), close1)// Second smoothing using EMAopen2 = ExponentialAverage[len2](haOpen)close2 = ExponentialAverage[len2](haClose)high2 = ExponentialAverage[len2](haHigh)low2 = ExponentialAverage[len2](haLow)RETURN close2 AS "Close", open2 AS "Open", high2 As "High", low2 AS "LowTo start with, I’m just trying to plot the OHLC from the 2nd EMA.
The issue I’m having is that open2, high2, and low2 don’t seem to have a value, as shown in the screenshot.
I’ve tried debugging but can’t find the issue.
If anyone knows where I’m going wrong, I’d really appreciate your help!
10/17/2024 at 12:25 PM #239146Some code has to be executed only after the lookback period has elapsed:
12345678910111213141516171819202122232425262728// Variables (defined as Indicator Variables)len = 20len2 = 20// First smoothing using EMAopen1 = ExponentialAverage[len](open)close1 = ExponentialAverage[len](close)high1 = ExponentialAverage[len](high)low1 = ExponentialAverage[len](low)IF BarIndex > max(len,len2) THEN// Generating the Heikin Ashi candleshaClose = (open1 + high1 + low1 + close1)/4IF BarIndex = 0 THENhaOpen = ROUND((open1 + close1) / 2, 2)ELSEhaOpen = ROUND((haOpen[1] + haClose[1]) / 2, 2)ENDIFhaHigh = Max(Max(high1, haOpen), close1)haLow = Min(Min(low1, haOpen), close1)// Second smoothing using EMAopen2 = ExponentialAverage[len2](haOpen)close2 = ExponentialAverage[len2](haClose)high2 = ExponentialAverage[len2](haHigh)low2 = ExponentialAverage[len2](haLow)endifRETURN close2 AS "Close", open2 AS "Open", high2 As "High", low2 AS "Low"1 user thanked author for this post.
10/17/2024 at 12:39 PM #239147Thank you so much Roberto. That makes sense!
I did try the PRELOADBARS function because I thought it may have had something to do with the lookback period, but it doesn’t allow it as part of an indicator.
Your solution is neat.
Thanks!
-
AuthorPosts
Find exclusive trading pro-tools on