Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Coloring a region between two doble values

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

    Coloring a region between two doble values

    Hi,

    I have created an indicator which uses two lines:

    AddLine(Brushes.Crimson, Value1, "BandInf");
    AddLine(Brushes.Green, Value2, "BandaSup");

    Value 1 is 1.0 and Value 2 is 2.0.

    I would like to know how to color the region between those two lines (which use two double values). I tried to do it using Draw.Region():

    Draw.Region(this, "tag1", CurrentBar, 0, Value1, Value2, null, Brushes.Blue, 50);

    But it does not allow me to do that. I get an error message which says that the variables can't be converted.

    Is there any way to do it?

    Thank you!

    #2
    Hello Plaket,

    Thank you for the post.

    The Draw.Region tool expects two ISeries as inputs. Unless you have a plot to pass into that indicator it will not work with two double values. Since you are coloring the region between two static horizontal lines, you may use the Draw.RegionHighlightY() drawing tool.

    Please let me know if I can assist further.

    Comment


      #3
      Thanks ChrisL.

      If I write the next line on the indicator:

      Draw.RegionHighlightY(this, "tag1", false, 2, 0, Brushes.Blue, Brushes.Green, 20);

      it draws a region on the chart panel, however I need to draw the region on the indicator panel. Is there any other solution?

      Thank you!

      Comment


        #4
        Hello Plaket,

        Set DrawOnPricePanel to false and then remove the instance of the indicator and add a new instance.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thank you!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by cmoran13, 04-16-2026, 01:02 PM
          0 responses
          46 views
          0 likes
          Last Post cmoran13  
          Started by PaulMohn, 04-10-2026, 11:11 AM
          0 responses
          28 views
          0 likes
          Last Post PaulMohn  
          Started by CarlTrading, 03-31-2026, 09:41 PM
          1 response
          163 views
          1 like
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          98 views
          1 like
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          158 views
          2 likes
          Last Post CaptainJack  
          Working...
          X