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 PaulMohn, Today, 05:00 AM
    0 responses
    7 views
    0 likes
    Last Post PaulMohn  
    Started by ZenCortexAuCost, Today, 04:24 AM
    0 responses
    6 views
    0 likes
    Last Post ZenCortexAuCost  
    Started by ZenCortexAuCost, Today, 04:22 AM
    0 responses
    3 views
    0 likes
    Last Post ZenCortexAuCost  
    Started by SantoshXX, Today, 03:09 AM
    0 responses
    16 views
    0 likes
    Last Post SantoshXX  
    Started by DanielTynera, Today, 01:14 AM
    0 responses
    5 views
    0 likes
    Last Post DanielTynera  
    Working...
    X