Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw.Region problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Draw.Region problem

    Hello,

    I am trying to draw a region when the Plot0 is above Zero line, but it doesn'w work very well as you can check in the picture attached.

    My code is as follows:

    if(Plot0[0]>=0 && controlcorte) {icorte++; barrascorte=CurrentBar; controlcorte=false;}
    if(Plot0[0]<0.05) controlcorte=true;

    if(Plot0[0]>0) Draw.Region(this,"tag1"+icorte,(CurrentBar-barrascorte),0,Plot0,Zero,null,Brushes.White,50);

    Please, help me to understand what I am doing wrong.

    Thanks in advance
    Attached Files

    #2
    Hello Sangui,

    Thanks for opening the thread.

    I would advise to use the first overload for Draw.Region so you supply a Series<double> and a double holding the value for your zero line.

    Draw.Region will draw shapes filling in the gap between these Series<double> values and the value for the zero line specified.

    If you would like to only draw shapes above the zero line, I suggest to create your own Series<double> that is synchronized with the primary data series and has a MaximumBarsLookBack of MaximumBarsLookBack.Infinite. You should then check if the Plot's value is above your zero line. If it is, assign it to the Series<double>. If not, assign the Series<double> the value of your zero line.

    I have attached a rough example that can demonstrate this on an ES chart.

    Please let me know if I may be of further assistance.
    Attached Files

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    670 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    379 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    111 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    575 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    582 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X