Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 mattbsea, Today, 05:44 PM
    0 responses
    5 views
    0 likes
    Last Post mattbsea  
    Started by RideMe, 04-07-2024, 04:54 PM
    6 responses
    31 views
    0 likes
    Last Post RideMe
    by RideMe
     
    Started by tkaboris, Today, 05:13 PM
    0 responses
    2 views
    0 likes
    Last Post tkaboris  
    Started by GussJ, 03-04-2020, 03:11 PM
    16 responses
    3,282 views
    0 likes
    Last Post Leafcutter  
    Started by WHICKED, Today, 12:45 PM
    2 responses
    20 views
    0 likes
    Last Post WHICKED
    by WHICKED
     
    Working...
    X