Heikin Ashi 4 hours in a 1 minute timeframe
Forums › ProRealTime English forum › ProBuilder support › Heikin Ashi 4 hours in a 1 minute timeframe
- This topic has 14 replies, 4 voices, and was last updated 6 years ago by Leo.
-
-
02/21/2018 at 8:56 AM #63343
Hi
I am using a 4 hour Heikin Ashi filter in one of my trading strategies (e.g. when 4h Heikin Ashi is green the main trent is Bull and when it becomes red then trent has changed to Bear). The trigger for buy/sell is done in a 1 minute chart and I wounder if it is possible to create a code that will give tru/false (1/-1) for the filer (4h HA) in the 1 minute chart?
02/21/2018 at 9:17 AM #63351I moved your post to a whole new topic.
I think that it would be possible to code something about this idea. But, do you want to know the 4 hours Heikin Ashi candlestick color while it is still not closed in this timeframe? Or do you want to update the info only once the 4h candle has closed (so one time each 4 hours)?
02/21/2018 at 10:44 AM #63364Hi Nicolas and thank´s for your answer!
Yes, I want to know if 4 hr Heikin Ashi is green (bull) or red (bear) during the 4 hr period (sometimes it switches from bull to bear /bear to bull during the open period). E.g when I have a trigger buy (bull position) in my 1 minute chart the overall trend, during the open period, 4 hour Heikin Ashi has to be bull (green). Otherwise, the trigger is false.
I want the script to test in the current period how 4 hr Heikin Ashi is located, red or green (not the previous closed period)
Now I using this script (I think you’ve created it), see below. At the moment I doing the filtering manually and it would be greath if I can ad a code into the 1 minute trigger script.
12345678910111213141516if barindex>1 thenhaclose=(open+close+low+high)/4haopen=(haopen[1]+haclose[1])/2xHigh = Max(haOpen, haClose)xLow = Min(haOpen, haClose)hahigh = Max(High,xHigh)halow = Min(Low,xLow)endifif haclose>hahigh[1] thenlsignal = 1elsif haclose<halow[1] thenlsignal = -1endifreturn lsignal as "BULL or BEAR"Thanks in advance
02/21/2018 at 12:48 PM #63380Paste the wrong code.
This is the code i’m using for manual filtering.
12345678910111213141516171819202122ONCE PreviousStatus = 0IF BarIndex = 0 THENXClose = TotalPriceXOpen = (Open + Close) / 2ELSEXClose = TotalPriceXOpen = (XOpen[1] + Xclose[1]) / 2ENDIFval1=0val2=0IF XClose >= XOpen THENIF PreviousStatus <> 1 THENval1=1PreviousStatus = 1ENDIFELSEIF PreviousStatus <> -1 THENval2=1PreviousStatus = -1ENDIFENDIFreturn val1 as "Bull-Green HA", val2 as "Bear-Red HA"02/22/2018 at 8:39 AM #63445I made this code, it is only compatible for a 1 minute timeframe. I made comparison with the 4 hours timeframe and it seems good.
12345678910111213141516171819202122232425//https://www.prorealcode.com/topic/heikin-ashi-4-hours-in-a-1-minute-timeframe///Nicolas@prorealcode.comif minute=1 and (hour=0 or hour=4 or hour=8 or hour=12 or hour=16 or hour=20) thenopenh4=openhighh4=0lowh4=close*100haopen=(haopen[1]+haclose[1])/2drawvline(barindex)drawtext("#haclose#",barindex,1)endifhighh4 = max(highh4,high)lowh4= min(lowh4,low)haclose=(openh4+close+lowh4+highh4)/4if haclose>haopen thensignal=1r=0g=200elsesignal=-1r=200g=0endifreturn signal coloured (r,g,0) style(histogram)1 user thanked author for this post.
02/22/2018 at 10:12 AM #6346302/22/2018 at 10:17 AM #63465Sorry, english topic..
Made a complete indicator with more options, in particular the capability to choose higher timeframe: Heikin Ashi of higher timeframes (hourly TF)
02/22/2018 at 10:47 AM #6347002/22/2018 at 10:51 AM #63472Because Heikin Ashi refer to last known candle at its open, so the more data you have the better and accurate is the calculation. Because we try here to get the superior timeframe value, we need many bars to compute at least 3 or 4 H4 candlesticks and get the same HAOPEN than in the superior timeframe. Hope it’s clear.
1 user thanked author for this post.
02/22/2018 at 10:59 AM #6347602/23/2018 at 11:46 AM #63650Hi Nicolas,
Many thanks the response and the code. It looks like imitating 4 hr Heikin Ashi very well. I will try and see how it works. What changes to the code would I have to do if I were to emulate 1 hr Heikin Ashi to the 1 minute graph?
02/23/2018 at 11:51 AM #63652What changes to the code would I have to do if I were to emulate 1 hr Heikin Ashi to the 1 minute graph?
Nothing to change, use the indicator I posted in the library and set the setting to “1”. Everything is explained in the above link.
1 user thanked author for this post.
02/23/2018 at 12:18 PM #63658What changes to the code would I have to do if I were to emulate 1 hr Heikin Ashi to the 1 minute graph?
Nothing to change, use the indicator I posted in the library and set the setting to “1”. Everything is explained in the above link.
Ok, thank’s! I tryed to use the indicator that you have created but something seems to be wrong. See attached picture.
02/23/2018 at 1:19 PM #63665You made a wrong copy/paste. Please download the .itf file and import it directly into your platform: How to import and export codes from ProRealTime platform?
1 user thanked author for this post.
02/23/2018 at 4:46 PM #63719 -
AuthorPosts
Find exclusive trading pro-tools on