Multi time frame candle

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #237076 quote
    robert123
    Participant
    Master

    Hi all,

    Has anyone managed to program a multi-timeframe candle/bar chart where the most current candle is ‘live’ rather than having to wait for it to close?

    Many thanks,

    Robert

    #237099 quote
    Iván González
    Moderator
    Master

    Hi Robert,

    Here’s an example of how to create a multi-timeframe candle chart in real-time without waiting for the candle to close. The code accesses the 1-hour candle data and draws it live on the chart:

    timeframe(1h) // 1-hour data
    liveHigh = high
    liveLow = low
    liveOpen = open
    liveClose = close
    
    if liveClose > liveOpen then
        r = 255
        g = 255
        b = 255
    else
        r = 255
        g = 0
        b = 0
    endif
    
    drawcandle(liveOpen, liveHigh, liveLow, liveClose) coloured(r, g, b)
    
    return
    

    This code draws the live candle with color adjustments based on whether it’s bullish or bearish. You can modify it to fit your needs.

    #237106 quote
    robert123
    Participant
    Master

    Thank Ivan for your help, not sure what I am doing wrong but your code seems to return the same as the input TF( if that makes sense)

    #237112 quote
    Iván González
    Moderator
    Master

    Hi!
    You need open new graph with 1H timeframe to check it.

    #237115 quote
    robert123
    Participant
    Master

    Thanks, Ivan,  So there is no way to have just a single ‘hourly bar’? on a lower TF, Someone ( I can’t find the post) had a go at it but the live candle was somewhat iffy.

    #237120 quote
    Iván González
    Moderator
    Master
    #237126 quote
    robert123
    Participant
    Master

    No- it was another one, I will have a look for it and update.

    #237131 quote
    robert123
    Participant
    Master

    Hi Ivan,

    This is the code I meant(bottom of page), however, it doesn’t update the current bar, is there any way of getting it to do so?  https://www.prorealcode.com/topic/show-5-minute-candlestick-in-1-minute-chart/page/2/

    R

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

Multi time frame candle


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
robert123 @robert123 Participant
Summary

This topic contains 7 replies,
has 2 voices, and was last updated by robert123
1 year, 5 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 09/04/2024
Status: Active
Attachments: 3 files
Logo Logo
Loading...