Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Removing Draw objects

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

    Removing Draw objects

    Hello

    If I am drawing a line with the code below, when I remove it do I have to set the Brush to null? The issue that gives is that, after the first Line is removed, the next ones are being drawn with the default colour and dash style, rather than the brushes I set in my indicator.

    I'm getting a compile error of DashStyleHelper not being a nullable value when I try to remove also the Dash Style - do I not have to remove that as well?

    Do I have to set the Line to null as well even if it is not created as an object (i.e. Line myLine = Draw.Line(...)...Remove....myLine = null), or do I have to create as objects the Lines I plan to Remove later on?

    Thank you

    Code:
    Draw.Line(this, "negDiv 1 " +  " / P S " + LastHSwDMIpriceBar[j - 1] + " / P E " + PriceHighBar[b - 1] + " / D S " + LastHSwDMIbar[j - 1] + " / D E " + HSwDMIbar[b - 1], true, CurrentBar - LastHSwDMIpriceBar[j - 1], LastHSwDMIprice[j - 1], CurrentBar - PriceHighBar[b - 1], HSwDMIprice[b - 1], negDivColour, divDashStyle, 1, true);
    
    ....
    
    RemoveDrawObject("negDiv 1 " + " / P S " + LastHSwDMIpriceBar[j - 1] + " / P E " + PriceHighBar[b - 1] + " / D S " + LastHSwDMIbar[j - 1] + " / D E " + HSwDMIbar[b - 1]);
    negDivColour = null;
    // divDashStyle = null;
    Last edited by itrader46; 02-01-2020, 05:12 PM.

    #2
    Hello itrader46,

    You can have a few windows media brushes for different colors..

    When is the variable with the null object intended to be initialized and assigned?

    No, you will not need to set the line to null.

    The example I have for brushes relates to rendering, but re-using windows media brushes and sharpdx brushes are similar.
    https://ninjatrader.com/support/foru...606#post789606
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    43 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    29 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    46 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    38 views
    0 likes
    Last Post CarlTrading  
    Working...
    X