Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DX Brushes for drawing heatmap best practice.

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

    DX Brushes for drawing heatmap best practice.

    Hi,

    I have an indicator that draws a heatmap in OnRender. At the moment I am creating a single SharpDX Brush at the beginning of OnRender using a base color, then reassigning it as necessary in a later "for" loop, and disposing of it at the end of OnRender:

    Code:
    				SharpDX.Direct2D1.Brush baseBrushDX = baseColor.ToDxBrush(RenderTarget);
    				
    				for // loop
    				{
    				SharpDX.Direct2D1.SolidColorBrush baseBrushDX  = new SharpDX.Direct2D1.SolidColorBrush(RenderTarget,GetColor(ratio, opacity));
    				//do the drawing
    					
    				}
    				baseBrushDX.Dispose();
    This works fine, but I suspect it's not the best or most efficient way of handling it. Is there a better way?

    Thanks

    #2
    Hello palinuro,

    Thank you for your note.

    Your script looks in line with the SampleCustomRender indicator preloaded on NinjaTrader, where you create a brush, assign and then dispose of it.

    You could also see another example which follows the same format,
    https://ninjatrader.com/support/foru...d=7&linkid=973

    Please let us know if you need further assistance.
    Alan P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by toughiee, Today, 12:04 AM
    0 responses
    2 views
    0 likes
    Last Post toughiee  
    Started by vdoan20, Yesterday, 08:30 PM
    0 responses
    7 views
    0 likes
    Last Post vdoan20
    by vdoan20
     
    Started by gupagoer, Yesterday, 07:42 PM
    0 responses
    9 views
    0 likes
    Last Post gupagoer  
    Started by Holligoly, Yesterday, 05:13 PM
    2 responses
    11 views
    0 likes
    Last Post Holligoly  
    Started by Raginpower, Yesterday, 01:53 PM
    0 responses
    14 views
    0 likes
    Last Post Raginpower  
    Working...
    X