Draw a coloured zone that desiappears unter certain conditions

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #241626 quote
    ioannispapadakis
    Participant
    New

    Hi,

    I want to draw a coloured colured zone only if the closing bar at 15 min TF is higher than a certain level. I tried the following code where I set a colour zone between ZUP and ZDOWN but it doesn’t work and the zone doesn’t disappear when the condition isn’t fulfilled.

     

    defparam drawonlastbaronly=true

    TimeFrame(15 minutes)

    if close[0]>6900 then
    ZUP=6900
    ZDOWN=6800
    endif

    Return ZUP as “ZUP”, ZDOWN as “ZDOWN”

     

    Can you please help me?

     

    Thank you in advance!

    John

    #241629 quote
    JS
    Participant
    Senior

    Try this one…

    DefParam DrawOnLastBarOnly=True
    
    TimeFrame(15 minutes,UpdateOnClose)
    
    If Close>42100 then
    ZUp=42100
    ZDown=42000
    ColorBetween(ZUp,ZDown,"Green",50)
    Else
    ColorBetween(ZUp,ZDown,"Green",0)
    EndIf
    
    Return
    #241636 quote
    ioannispapadakis
    Participant
    New

    Unfortunately this doesn’t work. The zone doesn’t disappear when the instrument drops below a certain level.

    #241641 quote
    JS
    Participant
    Senior

    Hi John,

    Try this one…

    ZUp=42100
    ZDown=42000
    
    If Close>42900 then
    drawrectangle(BarIndex-50,ZDown,barindex,ZUp) coloured(0,255,0,30) bordercolor(0,255,0,0)
    else
    drawrectangle(BarIndex-50,ZDown,barindex,ZUp) coloured(255,0,0,0) bordercolor(0,255,0,0)
    endif
    
    Return
    robertogozzi and Iván González thanked this post
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Draw a coloured zone that desiappears unter certain conditions


ProBuilder: Indicators & Custom Tools

New Reply
Author
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by JS
1 year, 1 month ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 12/20/2024
Status: Active
Attachments: 1 files
Logo Logo
Loading...