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 CaptainJack, 05-29-2026, 05:09 AM
        0 responses
        173 views
        0 likes
        Last Post CaptainJack  
        Started by CaptainJack, 05-29-2026, 12:02 AM
        0 responses
        91 views
        0 likes
        Last Post CaptainJack  
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        130 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        209 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        186 views
        0 likes
        Last Post CarlTrading  
        Working...
        X