Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Better Way to access Draw Objects?

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

    Better Way to access Draw Objects?

    I have an indicator that is accessing drawing objects on the chart drawn manually or from other indicator. The issue is that if there are a lot of drawn objects on the chart it will take forever to load as I have it coded to currently cycle through each Object in DrawObjects. Is there a better way to access draw objects on a chart? Since I am getting objects from other sources I don't know the tags of the objects so I can't use the function that allows me to access the specific object.

    Thanks!

    #2
    Hello Vikuno1,

    The DrawObjects collection would be the only collection with these objects.

    However, how is the script functioning?

    Are you waiting for the last historical bar to loop through the collection, or are you looping through the collection on every historical bar?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello Vikuno1,

      The DrawObjects collection would be the only collection with these objects.

      However, how is the script functioning?

      Are you waiting for the last historical bar to loop through the collection, or are you looping through the collection on every historical bar?
      As of now I am looping through the objects every bar as I want a signal to show based on whether or not a certain bar has a certain condition true. But I guess I could loop once at the end of the historical state. I would just need to create some sort of dictionary to keep track of the objects on each bar and draw the signals historically however many bars away.

      Thanks!

      Comment


        #4
        Hello Vikuno1,

        In historical the DrawingObjects collection is not likely going to change with manually drawn objects. The signal would be the same every historical bar. In real-time the user might be adding or removing drawing objects.

        Likely you could wait until the last bar, loop through the collection, and set flags on any historical bars you would like.

        Or you could loop through the collection on the first bar, detect the object you are looking for, set a variable, and just reference that variable as each historical bar processes.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        557 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        324 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
        545 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        547 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X