Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Best way to draw region between plots in indicator?

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

    Best way to draw region between plots in indicator?

    I want to draw regions between sections of plots in my custom ADX/DMI indicator.
    Currently I'm doing it with the Draw.Region method (https://ninjatrader.com/support/help...raw_region.htm), but this creates lots of drawing objects that are visible in the 'Drawing Objects' window.
    Is there a better way, or at least a way to hide these regions from the Drawing Objects window?

    My code is (snippet):

    Code:
    private Region lastregion = null;
    
    ....
    in OnBarUpdate() :
    ....
    
    if (adxTrend[0] && ((ADXPlot[0]<DiPlus[0] && ADXPlot[0]>DiMinus[0]) || (ADXPlot[0]>DiPlus[0] && ADXPlot[0]<DiMinus[0])) ) {
        if (lastregion==null)
            lastregion = Draw.Region(this, "adx" + CurrentBar, Time[1], Time[0], DiPlus, DiMinus, Brushes.Yellow, Brushes.Yellow, 100);
        else
            lastregion.EndAnchor.Time = Time[0];
        //re-using lastregion to reduce the amount of regions drawn
    } else {
        lastregion = null;
    }
    See screenshot below.

    Click image for larger version  Name:	DrawRegion indicator.png Views:	0 Size:	63.7 KB ID:	1127245

    #2
    Hello wjadevries,

    Thank you for your post.

    You'd need to look into custom rendering using SharpDX to render objects that wouldn't show in the Drawing Objects dialog box.





    I would suggest looking at the Ichimoku Cloud indicator that's publicly available on our User App Share as well as the built in Sample Custom Render indicator for examples.

    This indicator was ported from the Ichimoku Cloud indicator for NinjaTrader 7. The Cloud&#8217;s points are constructed identically to the NinjaTrader 7 indicator, however the points are then used to construct new SharpDX PathGeometry Figures. 3/24/2021: Modified the Adjust Chart Margins feature so users are prompted when the indicator wants to change the Chart&#8217;s Right [&#8230;]


    Please let us know if we may be of further assistance to you.

    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

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    579 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    334 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
    554 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    551 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X