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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    44 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    58 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    35 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    95 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    59 views
    0 likes
    Last Post PaulMohn  
    Working...
    X