Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using Brushes to color part of the Chart

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

    Using Brushes to color part of the Chart

    I'm having trouble trying to figure out how to use BackBrush to color a portion of the chart. I'm trying to code an band around an SMA. I can add plots and make a band. However, I want to color the background in between the bands ONLY. This is what I have so far. It just colors the whole chart.

    if(BandOn == true)
    {
    BackBrush = Math.Abs(MABand0[1] - Value[0]) == Deviation ? BandColor : BandColor;

    if(IsRising(Value))
    {
    PlotBrushes[0][0] = Bullish;
    }

    else {PlotBrushes[0][0] = Bearish;}
    }

    #2
    Hello jamestrader21x,

    To color the band or area between plots you can use the Region drawing tool for that purpose. There is also a more complex sharpDX version which I have linked as well, that is a more efficient approach if you need to do many regions and is also more configurable on how the region is rendered.



    This is a Helper/Wrapper for SharpDX rendering so you may focus more on the study of your Strategy or Indicator without having to worry about SharpDX resource management or OnRender() errors. Traditional SharpDX implementations are still recommended for the best performance. Note The included demo indicator includes a custom FilePicker that must have a reference […]


    I look forward to being of further assistance.

    The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.

    Comment


      #3
      Thanks! I got it working!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      566 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      330 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      547 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      548 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X