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!
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
NinjaTrader
Check Draw objects for null before removing
Collapse
X
-
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.
-
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:
-
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:
-
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 && [COLOR=#B22222]DrawObjects["Rebound Up = " + RebUpBar[a-1]] as DrawingTools.ArrowUp != null[/COLOR]) { RemoveDrawObject("Rebound Up = " + RebUpBar[a-1]); RebUpBar.RemoveAt(a-1); a--; } Thank you
Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Davidtowleii, Today, 12:15 AM
|
0 responses
3 views
0 likes
|
Last Post
by Davidtowleii
Today, 12:15 AM
|
||
Started by guillembm, Yesterday, 11:25 AM
|
2 responses
9 views
0 likes
|
Last Post
by guillembm
Yesterday, 11:58 PM
|
||
Started by junkone, 04-21-2024, 07:17 AM
|
9 responses
68 views
0 likes
|
Last Post
by jeronymite
Yesterday, 11:51 PM
|
||
Started by trilliantrader, 04-18-2024, 08:16 AM
|
4 responses
20 views
0 likes
|
Last Post Yesterday, 10:33 PM | ||
Started by mgco4you, Yesterday, 09:46 PM
|
1 response
11 views
0 likes
|
Last Post Yesterday, 09:56 PM |
Leave a comment: