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

Please note that this code does?

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

    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)))

    #2
    So .Locked explained



    So if you don't have an UpTrendRay or you have one and it is Locked... And same with DownTrendRay, do something...

    Comment


      #3
      Hello julifro,

      Thank you for your post.

      sledge is correct here.

      Comment


        #4
        thanks for the reply.
        However someone can clarify that puts == null.
        In the help of the method it appears! = Null and this indicator appears == null. You can be modified in this way a method?

        Comment


          #5
          Sorry, I'm not understanding what you are asking...

          NULL means nothing. So == null is a check for nothing.

          Comment


            #6
            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


              #7
              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...
              Code:
              [B]if [/B]( ((DrawObjects["UpTrendRay"] ==null) [B]||[/B] (DrawObjects["UpTrendRay"].Locked)) [B]&&[/B] ((DrawObjects["DownTrendRay"] ==null) [B]||[/B](DrawObjects["DownTrendRay"].Locked)))
              ..can be written as the following:
              If UpTrendRay is not found or it is locked and DownTrendRay is not found or it is locked.

              Comment


                #8
                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 ScottW, Today, 06:09 PM
                0 responses
                2 views
                0 likes
                Last Post ScottW
                by ScottW
                 
                Started by Board game geek, 10-29-2023, 12:00 PM
                14 responses
                244 views
                0 likes
                Last Post DJ888
                by DJ888
                 
                Started by Waxavi, 04-19-2024, 02:10 AM
                4 responses
                56 views
                0 likes
                Last Post sonia0101  
                Started by cmtjoancolmenero, Today, 03:58 PM
                0 responses
                9 views
                0 likes
                Last Post cmtjoancolmenero  
                Started by Segwin, 05-07-2018, 02:15 PM
                11 responses
                1,779 views
                0 likes
                Last Post aligator  
                Working...
                X