Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    Chris L.NinjaTrader Customer Service

    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 wzgy0920, 02-22-2024, 01:11 AM
          5 responses
          32 views
          0 likes
          Last Post wzgy0920  
          Started by wzgy0920, Yesterday, 09:53 PM
          2 responses
          49 views
          0 likes
          Last Post wzgy0920  
          Started by Kensonprib, 04-28-2021, 10:11 AM
          5 responses
          191 views
          0 likes
          Last Post Hasadafa  
          Started by GussJ, 03-04-2020, 03:11 PM
          11 responses
          3,230 views
          0 likes
          Last Post xiinteractive  
          Started by andrewtrades, Today, 04:57 PM
          1 response
          14 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Working...
          X