Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Access a drawing object that is hand drawn, in NinjaScript?

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

    Access a drawing object that is hand drawn, in NinjaScript?

    If I were to hand draw a trend line for example in a chart with the line drawing object, is it possible to reference that configured drawing object by Tag in my Ninjascript code and gauge how far away my previous close was to that line?

    #2
    Hi Erik, thanks for writing in.

    You can use the DrawObjects array to find a draw object on the chart by its Tag, see the link below for an example use case:
    https://ninjatrader.com/support/help...rawobjects.htm

    Best regards,
    -ChrisL

    Comment


      #3
      Thanks Chris

      Comment


        #4
        One more question, I am able to access it, but I want to be able to access the data.start time and data. end time as well as start y and end y. those are not properties of drawingTools.Line. Anyway to do this?

        Comment


          #5
          I think you may need to look to the anchor of the object. Draw.Line has signatures that include startTime and endTime properties of the ANCHOR as DateTime objects...you should be able to access these with something like myline.StartAnchor.Time or similar...

          I do similar things in OnRender with other drawing objects like up/downarrows...not lines

          [Edit: Well... actually what I do is on NinjaScript-created objects... not hand-drawn... hope that does not render my advice incorrect. It's 4 AM where I am... I'll revisit this tomorrow and do a test debug with a hand-drawn Line ... unless NT Support provide an answer beforehand]
          Cheers,
          T.
          Last edited by tgn55; 05-21-2021, 12:27 PM.

          Comment


            #6
            Thanks T, that worked!

            Comment


              #7
              Hi Erik,

              The Line object holds all of the data points needed. See the "Looping through the collection to find specific draw objects" section of the page I linked previously.

              Best regards,
              -ChrisL

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              594 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              343 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              103 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              556 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              554 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X