Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

reducing the number of Rays drawn

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

    reducing the number of Rays drawn

    Hi,

    I've got too many Rays drawn on my chart (it's doing as per code) but I would like to restrict or curb the number of Rays drawn as some Rays are no longer relevant (too old) and are occupying precious real estate.

    Could I restrict the number of Rays drawn to say the most recent 15? How would I do that?
    Alternatively, could I have keep Rays drawn which begin from a specific day or specific time (like from yesterday 12pm?
    Or could have I keep Rays which are drawn within a certain range (like yesterday's trading range)?

    I tried de-selecting autoscale and adjusting the chart scale but it didn't help. By the time I re-scaled it, the candles were mostly below the bottom of the chart window.

    Regards
    Kay Wai
    Last edited by kaywai; 05-23-2022, 04:20 AM.

    #2
    Hello kaywai,

    You can restrict the number of drawn objects by using either non unique tag names or logic to remove old objects.

    If you wanted to always have 15 total objects you can use non unique tags, for example re use the same 15 tags. Each time you re use a tag it will update the old object to the new values effectively moving the object and limiting to a certain number of tags. You would have to modify your logic to work with repeating tags instead of making unique tag names for each object, this would be something you would have to figure out based on what you made.

    You can also use logic to remove old objects based on some factor. You can use RemoveDrawObject with tags of objects you created to remove them. One way to do that would be to use a for loop to loop over a number. This depends on how you make your tag, you would have to make tags that increment in order to be able to use a loop to later remove them by the tag name.

    An alternative would be to use a List and store the objects in the list after you draw them. Later you could loop over that list to remove objects based on whatever criteria you wanted.



    Comment


      #3
      THank you for your suggestions and guidance Jesse. I will take a look and work on it.

      Comment


        #4
        Hi Jesse,

        Is it possible if I wanted to use time to control whether Rays are drawn or not? If I were to draw rays from today's trading data? Would that be possible? Would time zones matter if I was trading the US markets from Asia?
        If I were to remove all drawing objects the the Draw.Rays indicator, would the rest of my drawn objects be removed as well?

        Regards
        Kay Wai

        Comment


          #5
          Hello kaywai,

          You could make time conditions to control when you draw something.

          The rays are being drawn based on your conditions so part of that condition could be a time/date condition.




          If I were to remove all drawing objects the the Draw.Rays indicator, would the rest of my drawn objects be removed as well?

          Any that were drawn by this script if you call RemoveDrawObject with its tag, other objects drawn by other scripts or manually are not affected.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          574 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          333 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          553 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          551 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X