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

How to get the Variables from a list of Rectangles

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

    How to get the Variables from a list of Rectangles


    I have drawn several Rectangles in a strategy that I use as Support and Resistance, but I need to update them

    I would like to get all the data of the rectangle for reading, basically startY, endY, StartTime

    I have tried to obtain the data of the list without any result



    foreach (DrawingTool draw in DrawObjects.ToList()){

    if (draw is DrawingTools.Rectangle && myZona !=null) {

    Print("List de Rectangle " + myZona.Anchors.ToList());

    }
    }

    #2
    Hello HGTrader,

    A code sample exists in the help guide.
    https://ninjatrader.com/support/help...rawobjects.htm

    May I confirm myZona is not null?

    if (myZona !=null)
    Print("myZona is not null");

    What is the DrawObjects.Count?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3

      I would like to get all the data of the rectangle for reading, basically startY, endY, StartTime

      I can see the information of these Variables, but when I print them only the last rectangle information comes out, but I need the information of each object in the list individually

      Print("Rectangle Object: " + draw.Tag + " Star Anchor " + myZona.StartAnchor);
      Print("Rectangle Object: " + draw.Tag + " End Anchor " + myZona.EndAnchor);
      Print("Rectangle Object: " + draw.Tag + " End Anchor " + myZona.StartAnchor.Time);


      Comment


        #4
        Hello HGTrader,

        I am not able to reproduce this behavior using the sample code from the help guide.

        Below is a link to a video of the test.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5

          Thank you very much I will try this to see if it works for me

          Comment


            #6
            Hello, what they sent me was very helpful, but when I run the strategy, it performs the search during all the past days, please can you help me to know how I can initialize so that the search begins at the time I have established.

            I need to initialize on every first Bar of the Session

            Comment


              #7
              Hello HGTrader,

              You can reset a variable when Bars.IsFirstBarOfSession (and optionally IsFirstTickOfBar) is true.

              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Hello, I understand that part perfectly, but how do I reset a Drawing list?

                drawing ??? .Clear()?

                Comment


                  #9
                  Hello HGTrader,

                  Are you trying to remove a drawing object from the chart?

                  That would be done with RemoveDrawObject().


                  Do you have a List<Rectangle> and you are want to reset the list? myList.Clear() would work.
                  Chelsea B.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by f.saeidi, Today, 08:03 AM
                  0 responses
                  4 views
                  0 likes
                  Last Post f.saeidi  
                  Started by cre8able, 04-17-2024, 04:16 PM
                  7 responses
                  64 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Started by Aviram Y, 08-09-2023, 09:04 AM
                  11 responses
                  299 views
                  0 likes
                  Last Post arjandezeeuw  
                  Started by Christopher Leggit, 02-15-2024, 09:00 AM
                  3 responses
                  47 views
                  0 likes
                  Last Post rdtdale
                  by rdtdale
                   
                  Started by DavidHP, Today, 07:56 AM
                  0 responses
                  4 views
                  0 likes
                  Last Post DavidHP
                  by DavidHP
                   
                  Working...
                  X