Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Get drawn objects

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

    Get drawn objects

    Hi

    How can I get by code the drawing objects which were placed on my screen by GUI. For example, if I have vertical line, I would like to know its date and color.

    Thanks

    #2
    Hello kiss987,
    Thanks for your post.

    You will need to loop through the drawing objects on your chart to find the vertical lines. Then to get the color in a format other than HEX you will need to use Reflection as seen in the attached sample.

    The following sample will look for a vertical line to be manually drawn and print the time of the line as well as the color to the NinjaScript Output window.

    Let me know if you have any questions.
    Attached Files
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      My charts crash unfortunately after spending several hours drawing objects during a trading session and I lose everything. Are the objects stored in xml anywhere or is it feasible to use this as a starting point for a script that tracks my drawing objects on the chart I am working on so after a 'crash', I can add the script to a new chart and reload my drawing objects?

      Comment


        #4
        Your drawing objects are stored in XML inside your workspace. So you would need to save your workspace to retrieve that information. You could also write the output from the indicator to a file using StreamWriter

        Help Guide - Using StreamWriter to write to a text file

        If your platform is crashing I suggest writing in to PlatformSupport(AT)NinjaTrader(DOT)com and having a technician look at your log and trace files.
        Josh G.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        648 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        369 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        108 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        572 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        573 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X