• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Check Draw objects for null before removing

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

  • NinjaTrader_Jesse
    replied
    Hello itrader46,

    I believe you understood correctly, you need to have a null check if you try to access a value the object has, otherwise if you are just removing it that is not needed.

    I look forward to being of further assistance.

    Leave a comment:


  • itrader46
    replied
    So you mean that I don't have to do the null check before removing the objects, but I have to do it before using them after drawing (i.e. trigger an action after drawing an arrow)?

    Leave a comment:


  • NinjaTrader_Jesse
    replied
    Hello itrader46,

    The RemoveDrawObject method would not specifically need check but if you are using the objects values prior to removing it you would want to make sure you check the object is not null before trying to use it.

    I look forward to being of further assistance.

    Leave a comment:


  • itrader46
    started a topic Check Draw objects for null before removing

    Check Draw objects for null before removing

    Hello

    Regarding removing Draw objects drawn by an indicator, when I want to remove an object (i.e. line, arrow, etc), would I have to do the null check before removing it, as in the code below?

    Code:
    if (a > 0 && CurrentBar == RebUpBar[a-1] + 1 && Low[0].ApproxCompare(Low[1]) < 0 && High[0] < High[1] + 5 * TickSize && DrawObjects["Rebound Up = " + RebUpBar[a-1]] as DrawingTools.ArrowUp != null)
    {
          RemoveDrawObject("Rebound Up = " + RebUpBar[a-1]);
          RebUpBar.RemoveAt(a-1);
          a--;
    }
    
    Thank you

Latest Posts

Collapse

Topics Statistics Last Post
Started by asmmbillah, Today, 02:23 PM
1 response
11 views
0 likes
Last Post NinjaTrader_Jesse  
Started by steveg, Today, 02:44 PM
0 responses
5 views
0 likes
Last Post steveg
by steveg
 
Started by BatBart, Today, 01:24 PM
1 response
11 views
0 likes
Last Post Jonsey529  
Started by lightsun47, Today, 12:33 PM
1 response
11 views
0 likes
Last Post NinjaTrader_Jim  
Started by Woomera, Today, 12:21 PM
2 responses
9 views
0 likes
Last Post Woomera
by Woomera
 
Working...
X