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
    Master

    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
    Scherm­afbeelding-2024-12-20-om-15.14.22.png Scherm­afbeelding-2024-12-20-om-15.14.22.png
    #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
    Master

    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.
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

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, 8 months ago.

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