if ( ((DrawObjects["UpTrendRay"] ==null) || (DrawObjects["UpTrendRay"].Locked)) && ((DrawObjects["DownTrendRay"] ==null) ||(DrawObjects["DownTrendRay"].Locked)))
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Please note that this code does?
Collapse
X
-
Please note that this code does?
Please can someone explain to me that means in this code == null and .locked and makes this piece of code ?. Thank you
if ( ((DrawObjects["UpTrendRay"] ==null) || (DrawObjects["UpTrendRay"].Locked)) && ((DrawObjects["DownTrendRay"] ==null) ||(DrawObjects["DownTrendRay"].Locked)))
Tags: None
-
I have not planted correctly the question.
the method used in the indicator'm studying is this
if (DrawObjects["someTag"] != null && DrawObjects["someTag"].DrawType == DrawType.Line
however the indicator used == null.
if ( ((DrawObjects["UpTrendRay"] ==null) || (DrawObjects["UpTrendRay"].Locked)) && ((DrawObjects["DownTrendRay"] ==null) ||(DrawObjects["DownTrendRay"].Locked)))
I do not understand because it uses == null
thanks and sorry for my English
Comment
-
Hello julifro,
Thank you for your response.
The condition is looking to see if the Up or Down Trend Ray is null or if it is locked. The '||' operator is or.
So the condition as...
..can be written as the following:Code:[B]if [/B]( ((DrawObjects["UpTrendRay"] ==null) [B]||[/B] (DrawObjects["UpTrendRay"].Locked)) [B]&&[/B] ((DrawObjects["DownTrendRay"] ==null) [B]||[/B](DrawObjects["DownTrendRay"].Locked)))
If UpTrendRay is not found or it is locked and DownTrendRay is not found or it is locked.
Comment
-
The DrawObjects collection implements an indexer, which allows items in the collection to be looked up by the drawing tools "Tag" using array notation []
Learn how to declare and use an indexer for a class, struct, or interface in C#. This article includes example code.
If it cannot find an element in the collection that matches that string name "Tag", the expression will return null.
Basically, that code is saying
"Check if the draw objects collection does not have a drawing tool with the tag "UpTrendRay" (i.e., the referenced tag does not exist in the collection)"MatthewNinjaTrader Product Management
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
117 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
166 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
85 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|
||
|
Started by cmoran13, 04-16-2026, 01:02 PM
|
0 responses
130 views
0 likes
|
Last Post
by cmoran13
04-16-2026, 01:02 PM
|
||
|
Started by PaulMohn, 04-10-2026, 11:11 AM
|
0 responses
88 views
0 likes
|
Last Post
by PaulMohn
04-10-2026, 11:11 AM
|


Comment