heikin ashi of higher timeframes under h1

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #71396 quote
    pableitor
    Participant
    Master

    Hi, I’m looking for a Heiken Ashi indicator that paints candles from a higher time frame . For instance my system operates in m1 and I am looking to validate entries if the HA candles in m15 or m5 are in the same direction than the m1 order (green HA in m5/m15 for m1 buy or red HA in m5/m15 for sell order).  I found a nice indicator by Nicolas Heikin Ashi of higher timeframes (hourly TF) but the minimum TF there is H1.  Is there anything similar for lower TF ?

    Thanks

    #71441 quote
    pableitor
    Participant
    Master

    I finally tweaked  Nicolas indicator code Heikin Ashi of higher timeframes (hourly TF) to allow for 5 & 15 min TF:

    defparam calculateonlastbars=10000 //increase this number to get more history
    TimeframeHAminutes = 15 //higher TF for HA in minutes
    Myminutes = openhour*60 + openminute
    
    if (Myminutes MOD TimeframeHAminutes = 0) then
    opentf = open
    hightf = 0
    lowtf = close * 100
    haopen =( haopen[1]+haclose[1])/2
    drawvline(barindex)coloured(100,100,100)
    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"

    Regards

    Nicolas and martinr thanked this post
    #71613 quote
    martinr
    Participant
    New

    Hi Pableitor, I thank you so much for sharing this.

    I would like to ask you for your help and maybe the help of Nicolas. I am desperate to display a Heiken Ashi indicator in m1. My system operates in s1. I try in TimeframeHAminutes in your indicator but it does not work. Can you help me please ?

    Thanks for your help.

    #71618 quote
    Nicolas
    Keymaster
    Master

    Hi martinr, what do you want to do exactly? Display M1 Heikin Ashi candlesticks on a M1 timeframe?

    #71620 quote
    martinr
    Participant
    New

    Hi Nicolas, I would like to display Display M1 Heikin Ashi candlesticks on a S1 (1 second) timeframe. I think it’s possible. Thank you for your help.

    I take this opportunity to saluate the extraordinary work you have done in creating this forum and all the indicators that you share. Bravo!

    #71626 quote
    Nicolas
    Keymaster
    Master

    oh sorry, S1 means 1 second TF .. of course 🙂

    Yes, I think that it would be possible to adapt the code that @pableitor has shared with us.

    Did you try to modify the setting just with:

    [scode] TimeframeHAminutes = 1 [/scode]

    Because it returns some red/green values in the 1 sec TF (see example attached).

    martinr thanked this post
    #71629 quote
    martinr
    Participant
    New

    Thank you very much. I’m testing

    #71631 quote
    martinr
    Participant
    New

    I had already tried. The histogram shows 1 second instead 1 minute! I tried to convert but there is no opensecond.

    Even when I try :

     TimeframeHAminutes = 2

    It does not show 2 minutes.

    I need your help.

    Thanks

    #71632 quote
    pableitor
    Participant
    Master

    Hi martinr,

    Pls check below code.

    defparam calculateonlastbars=3000 //increase this number to get more history
    TimeframeHAseconds = 60 //higher TF seconds
    
    Myseconds = openhour*3600 + 60*openminute + opentime MOD 60
    
    if (Myseconds MOD TimeframeHAseconds = 0) then
    opentf = open
    hightf = 0
    lowtf = close * 100
    haopen =( haopen[1]+haclose[1])/2
    drawvline(barindex)coloured(100,100,100)
    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
    endif
    
    return 1 coloured (r,g,0) style(histogram) as "HeikinAshi higherTF color", signal style(histogram) as "HeikinAshi higherTF change"

    I tweaked Nicolas indicator further so you can configure the higher TF in seconds (for m1 TimeframeHAseconds = 60) and display the m1 HA candle in a s1 chart.  I found sometimes the 1sec candle is missing in the streaming data which may lead to small inaccuracies when the missing s1 candle is the first one of each minute.  Beside this it seems to work fine, pls check it and advise if you need any info.

    Nicolas and martinr thanked this post
    #71681 quote
    martinr
    Participant
    New

    Thank you pableitor for your time. It works a lot better but there are still significant gaps between the “real” Heikin-Ashi “1 min and the one displayed on a graph of 1 sec.I also find that nothing is displayed after 3000 units which is logical since there is 3000 bar (calculateonlastbars) but even with 1000 bar, the signal is never at 0. This causes white margins.

    #71689 quote
    pableitor
    Participant
    Master

    Yes, I know what you mean.  The program takes the open at the very first second of each minute to calculate open for the next m1 HA candle , but I found at 1 sec level sometimes theres a data gap at the very first second of the minute so it loses accuracy.  At higher TF it works pretty good but I dont know how to tweak it to replace that missing 1sec data , sorry!

    #71712 quote
    martinr
    Participant
    New

    I think I have found the problem:

    defparam calculateonlastbars=3000

    When you change the number of units on the graph, the indicator changes completely.

    Look at the screenshots. It’s very weird.

    #71725 quote
    pableitor
    Participant
    Master

    calculateonlastbars=3000 should load like 50 min of 1 sec data. The bigger the better precision but takes longer to load. Anyway I think the problem is also the s1 missing data. Maybe somebody from PRT could tell us how to calculate m1 HA candles when the open 1sec  data is missing !

    #71813 quote
    Nicolas
    Keymaster
    Master

    You should use tick charts instead (tick by tick), no missing data because of clockwork in this case. Just like the way I did in this indicator: Cumulative Volume Delta with periods

    pableitor and martinr thanked this post
    #71979 quote
    martinr
    Participant
    New

    I will follow your advice and do some testing.

    Thank you very much.

Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.

heikin ashi of higher timeframes under h1


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
pableitor @pableitor Participant
Summary

This topic contains 14 replies,
has 3 voices, and was last updated by martinr
7 years, 8 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 05/26/2018
Status: Active
Attachments: 6 files
Logo Logo
Loading...