Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to adjust outline opacity in area highlight?

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

    How to adjust outline opacity in area highlight?

    Hello, I would like to set my outline opacity to zero on an auto drawn highlight. Here is my code:
    Code:
    Draw.RegionHighlightY(this, newprice.ToString(), false, newprice+(.25*Ticks_Per_Level), price, Thin_Spot_Color, Thin_Spot_Color, Region_Opacity)
    How would I go about doing this?

    #2
    Hello rbeckmann05,

    Thanks for your post.

    If you want to change the opacity argument for a specific draw object when a specific condition becomes true, you would need to call the Draw.RegionHighlightY() method again using the same exact Tag name and pass the new opacity value you want to use (0) in the 'int areaOpacity' argument.

    Draw.RegionHighlightY(NinjaScriptBase owner, string tag, bool isAutoScale, double startY, double endY, Brush brush, Brush areaBrush, int areaOpacity)

    From the help guide:

    Tag:
    A user defined unique id used to reference the draw object.
    For example, if you pass in a value of "myTag", each time this tag is used, the same draw object is modified. If unique tags are used each time, a new draw object will be created each time.


    See the help guide documentation below for more information.

    Draw.RegionHighlightY(): https://ninjatrader.com/support/help...highlighty.htm
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Hi Brandon,

      Thank you for the quick response. I am not necessarily interested in changing the area opacity, but instead the outline opacity. More specifically setting it to zero. I know its possible in manually drawn region highlights, so I figured it is possible with auto drawn highlights. Is there a different method I can use to change the outline opacity instead of area opacity?

      Comment


        #4
        Hello rbeckmann05,

        Thanks for your notes.

        You may consider creating and saving a Drawing Tool Template for the Region Highlight Y drawing tool and then use the Draw.RegionHighlightY() syntax that allows you to specify a template name.

        The name of the Drawing Tool Template you saved could be passed into the 'string templateName' argument so the Region Highlight Y drawing tool is drawn on the chart using the saved template parameters.

        Draw.RegionHighlightY(NinjaScriptBase owner, string tag, double startY, double endY, bool isGlobal, string templateName)

        See the Draw.RegionHighlightY() help guide document link on post # 2 for more information.

        Here is a help guide page about Understanding Drawing Object Templates: https://ninjatrader.com/support/help..._tools__ob.htm
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment


          #5
          That worked, thanks for the help!

          Comment


            #6
            How to do that with plots?


            This does not work:

            public class myindi : Indicator​
            {

            private int opacityNearUp, opacityNearDwn;​
            //private int opacityNearUp = 20;​
            //private int opacityNearDwn = 20;​



            protected override void OnStateChange()
            {
            if (State == State.SetDefaults)
            {​

            AddPlot(new Stroke(Brushes.Cyan, DashStyleHelper.Dash, 5, opacityNearUp), PlotStyle.Hash, "MyPlot1");

            AddPlot(new Stroke(Brushes.Magenta, DashStyleHelper.Dash, 5, opacityNearDwn), PlotStyle.Hash, "MyPlot2");​
            }
            }

            protected override void OnBarUpdate()
            {​

            if (X)
            {
            MyPlot1[0] = Open[0];
            opacityNearUp = (Close[0] < Open[0]) ? 95 : 20 ;
            }
            if(Y)
            {
            MyPlot2[0] = Close[0];​
            opacityNearDwn = (Close[0] > Open[0]) ? 95 : 20 ;​
            }
            }



            region Properties

            [Browsable(false)]
            [XmlIgnore]
            public Series<double> MyPlot1
            {
            get { return Values[0]; }
            }



            [Browsable(false)]
            [XmlIgnore]
            public Series<double> MyPlot2
            {
            get { return Values[1]; }
            }

            #endregion​
            }

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by cmoran13, 04-16-2026, 01:02 PM
            0 responses
            43 views
            0 likes
            Last Post cmoran13  
            Started by PaulMohn, 04-10-2026, 11:11 AM
            0 responses
            25 views
            0 likes
            Last Post PaulMohn  
            Started by CarlTrading, 03-31-2026, 09:41 PM
            1 response
            162 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