Drawing 5 minutes bar candles over a 1 minute bar chart

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #166021 quote
    snow_onar
    Participant
    Senior

    How can I draw a 5 min bar candle over 1 min bar chart? (see attachment yellow box)

    If I am setting DefParam DrawOnLastBarOnly = true then the following code shows the rigth solution. How can I addapt this code for the hole chart, not only the last 5 bars?

    DefParam DrawOnLastBarOnly = true
    
    hh5 = highest[5](high)
    ll5 = lowest[5](low)
    
    a=0
    for i = 0 to 4 do
    x1 = barindex[a]
    x2 = x1 -4
    DRAWRECTANGLE(x1,ll5,x2,hh5)coloured(255,255,0,275)
    next

     

    Thanks for your support.

    5mincandles.png 5mincandles.png
    #166028 quote
    pableitor
    Participant
    Master

    Check if  this simple code does the job :

    //plot 5min open-close box over 1 min chart
    
    timeframe(5mn,updateonclose )
    m5open = open
    m5close = close
    
    timeframe(default)
    if  openminute mod 5 = 0 then
    if m5open < m5close then
    r=0
    g=255
    else
    r=200
    g=0
    endif
    drawrectangle(barindex-5, m5open, barindex-1, m5close) coloured(r,g,0,32) bordercolor(r,g,0,60)
    endif
    
    return

    Just run it on 1 minute chart. Hope it helps!

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

Drawing 5 minutes bar candles over a 1 minute bar chart


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
snow_onar @snow_onar Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by pableitor
4 years, 10 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 04/02/2021
Status: Active
Attachments: 2 files
Logo Logo
Loading...