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 NullPointStrategies, Today, 05:17 AM
    0 responses
    20 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    119 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    63 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    41 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    45 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X