Higher timeframe bar

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #265339 quote
    robert123robert123
    Participant
    Master

    Higher timeframe candle code.

    I’ve been trying to find/code a higher-timeframe candle that doesn’t have the last-bar-updating bug.

    Here’s my attempt.

    robertogozzi thanked this post
    Higher-Timeframe-Bar.itf
    #265345 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    This code will draw a 15-minute candle on a lower timeframe, such as 5 or 1 minute:

    // Higher bars on a Lower TF
    //
    // GetTimeFrame     returns:
    //
    //           1 = 1 second
    //          10 = 10 seconds (10  * 1 second)
    //          60 = 1 minute   (60  * 1 second)
    //         300 = 5 minutes  (5   * 1 minute)
    //        3600 = 1 hour     (60  * 1 minute)
    //       14400 = 4 hours    (4   * 1 hour)
    //       86400 = 1 day      (24  * 1 hour)
    //      172800 = 2 days     (2   * 1 day)
    //      604800 = 1 week     (7   * 1 day)
    //     2592000 = 1 month    (30  * 1 day)
    //    31536000 = 1 year     (365 * 1 day)
    //          -1 = non time based TF
    //
    Timeframe(15 minutes,updateonclose)
    ONCE TFseconds = 15 * 60    //number of seconds in a 15-minute bar
    ONCE t  = 50                //Transparency (0-255, 0=invisible, 255=fully visible)
    ONCE ID = 0
    ID = ID + 1
    //
    C5 = close
    O5 = open
    H5 = high
    L5 = low
    //
    r  = 0
    g  = 255
    b  = 0
    If c5 < o5 then
    r = 255
    g = 0
    b = 0
    endif
    //
    Timeframe(15 minutes,default)
    //
    ONCE ID2 = 0
    ID2 = ID2 + 1
    //
    timeframe(default)
    ONCE TFdefault = GetTimeFrame
    IF TFdefault = TFseconds THEN
    TotalBars = 0
    Bar1      = 0
    Bar2      = 0
    ELSE
    TotalBars = TFseconds / TFdefault
    Bar1      = TotalBars - 1
    Bar2      = floor(TotalBars / 2)
    ENDIF
    //
    IF ID <> ID[1] THEN
    Drawrectangle(BarIndex - Bar1,O5,BarIndex,C5)             Coloured(r,g,b,t)style(line,1) bordercolor(r,g,b,t)  //Body  /style Line 2 = Dicke
    DrawRectangle(BarIndex - Bar2,max(O5,C5),BarIndex - Bar2,H5) Coloured(r,g,b,t)style(line,1) bordercolor(r,g,b,t)  //Upper Wick
    DrawRectangle(BarIndex - Bar2,min(O5,C5),BarIndex - Bar2,L5) Coloured(r,g,b,t)style(line,1) bordercolor(r,g,b,t)  //Lower Wick
    ENDIF
    Return
    
    Higher-bars-on-a-Lower-TF.itf
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Higher timeframe bar


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
robert123 @robert123 Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzirobertogozzi
1 hour, 4 minutes ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 09/25/2026
Status: Active
Attachments: 2 files
ProRealCode ProRealCode
Loading...