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 Mindset, 04-21-2026, 06:46 AM
      0 responses
      63 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      90 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      48 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      105 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      63 views
      0 likes
      Last Post PaulMohn  
      Working...
      X