Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DrawRegion - Need to Change Color Based On Indicator

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

    DrawRegion - Need to Change Color Based On Indicator

    I want to change the color of my DrawrRegion depending on the slope of one of my indictors. So if my indicator is rising I want the region to be blue but red if the indicator is falling.

    I am using the (non-working) construct:

    if(SmoothMidBandPlot[0]>SmoothMidBandPlot[1])
    {
    DrawRegion("tag1", 1, 0, OuterUpperPlot, SmoothMidBandPlot, Color.Empty, Color.RoyalBlue, 2);
    }
    else
    {
    DrawRegion("tag1", 1, 0, OuterUpperPlot, SmoothMidBandPlot, Color.Empty, Color.Salmon, 2);
    }

    I also tried drawing from CurrentBar to 1. How can I get the desired result?

    #2
    You are not changing the tag, so recreating same drawregion of 1 bar length each time....

    Try channging this ;

    DrawRegion("tag1"+CurrentBar,


    Regards,


    Pablo
    pmaglio
    NinjaTrader Ecosystem Vendor - The Indicator Store

    Comment


      #3
      dkrumholz, as pmaglio has pointed out, if you keep the tag the same, it will be redrawn every time the DrawRegion() method is called. Please try changing the tag on every bar ("tag1"+CurrentBar) and see if you get the behavior you want.
      AustinNinjaTrader Customer Service

      Comment


        #4
        Pablo - yes, thanks!! That slipped my mind.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        597 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        343 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        103 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        556 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        555 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X