Heiken Ashi from higher Timeframe do not work

Viewing 6 posts - 16 through 21 (of 21 total)
  • Author
    Posts
  • #164380 quote
    Jerome888
    Participant
    Average

    Update

    The code works well for daily, hourly but seems not to work for weekly TF (executed from 15 min TF as default TF)

    Do not understand why… Prorealcode is full of mysteries

    #164397 quote
    Jerome888
    Participant
    Average

    seems not to work for weekly TF executed from 15 min TF

    but works if executed from 1 hour

    So I guess from 15 min to weekly, we start to get some visible precision/rounding problems…

    I consider the problem closed

    #164415 quote
    pableitor
    Participant
    Master

    I just tweaked my previous code a little bit and this code works for me.

    timeframe(weekly)
    
    if barindex = 1 then
    xOpen = open
    endif
    if barindex > 1 then
    xClose=(open+high+low+close)/4
    xOpen =( xOpen[1] + xClose[1] )/ 2
    endif
    
    timeframe(default)
    RETURN xOpen AS "xOPen" , xClose as "xClose"
    BTW, this works also for daily TF , just replace “weekly” by “daily”  .   We have to calculate the HA values starting from barindex 1 on in the higher TF, otherwise we dont have valid values of  xOpen available !
    #164416 quote
    pableitor
    Participant
    Master
    @jerome888 after all I found your code in the first message of the thread was almost perfect, just needed to initialize xOpen like this:
    timeframe(daily)
    if barindex = 1 then
    xOpen = open
    endif
    #164513 quote
    Jerome888
    Participant
    Average
    Hi pableitor Thank you. I have tried the code, seems not to work on my side (I come back to the first problem x close is correct but not xopen). I will have to recheck again tomorrow but I am sure at 90% that it still contains a problem…
    #164623 quote
    Jerome888
    Participant
    Average
    Yes your above code works quite well. – From 1 h TF, no problem to get data of 1 week TF – From 15 min i get problem for getting 1 week TF data but I assume that is linked to the limited history (in 15min, with PRT complete version, I can display (so load I guess) only 233 units so 10 working days) So topic solved Thanks a lot for your support pableitor. (I will probably create same kind of topics for SMA and RSI since I fail as well to get the right values…)
Viewing 6 posts - 16 through 21 (of 21 total)
  • You must be logged in to reply to this topic.

Heiken Ashi from higher Timeframe do not work


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Jerome888 @jerome888 Participant
Summary

This topic contains 20 replies,
has 4 voices, and was last updated by Jerome888
4 years, 11 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 03/14/2021
Status: Active
Attachments: No files
Logo Logo
Loading...