Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Access Drawing Objects from third party indicator

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

    Access Drawing Objects from third party indicator

    Hi, is there an easy way to access a drawing object added to a chart via a third-party indicator? All functions for the indicator are accessed through a dll, and programatically obtaining information from the indicator does not appear to be feasible. Therefore, i am trying to obtain information (price, time, etc.) about the objects added to the chart. For example, a triangledown may be added when certain conditions are met. A triangleup may be added when other conditions are met. I have reviewed the following:



    however, when i attempt to access drawobjects.count for example and print the result, the result is always 0. I'm trying to find a way to return a list, with tags for example, for all triangleup objects currently displayed on the chart? Presumably, once I can access the object, the other information (price, time, etc.) should be accessible as well?

    Thank you

    #2
    Hello Renorail,

    This depends on how the other script is drawing, if it uses specifically drawing objects they could potentially be accessed however that would only be sometime after realtime. There is no reliable way to access drawing objects that are being drawn from a different script like this. While you can access them in realtime there is no expectation of timiing or being in sync in that use case. The link you provided would be that code which would be used. If the following code does not show the object at all being printed as a type, it cannot be accessed:

    Code:
    foreach (DrawingTool draw in DrawObjects.ToList())
    {
        Print(draw.GetType().FullName); 
    }

    I look forward to being of further assistance.

    Comment


      #3
      Thank you Jesse. I'll try the code and get back to you.

      Comment


        #4
        Hi Jesse, an example of what is printed by the above script is "OMD data missing: 225 12/2/2019 4:33:05 AM 5 1" - I'm assuming this means that the objects i am after cannot be accessed using the DrawObjects function.

        Comment


          #5
          Hello Renorail,

          The print i provided should be similar to: NinjaTrader.NinjaScript.DrawingTools.Line, using the count works as well it just has to be in realtime. What you provided seems to be related to a different print. If nothing was output in realtime, then yes it cannot be accessed from that collection. You can confirm your print is working by manually drawing an object on the chart and waiting for a realtime bar to close. The other item It may be rendering items using OnRender and in that case you could not access the drawings.

          I look forward to being of further assistance.

          Comment


            #6
            Hello Renorail,
            Were you able to resolve the drawing objects issue ?
            I am looking for a solution to detect objects drawn an indicator and either send it to the alert logs or export it to either a text file, csv or xls file.
            Regards,
            AH

            Comment


              #7
              I think I ended up going a different direction…basically reproducing the 3rd party indicator logic.

              Comment


                #8
                Hello again,
                Are you able to assist in the implementation of the 3rd party indicator logic ?
                Cheers

                Comment


                  #9
                  One point to note when trying to access drawing objects from third party indicator is that the indicator is likely to have been supplied in dll form (compiled). If so then the code for looping through the drawing objects needs to be slightly different as per the Considerations For Compile Assemblies https://ninjatrader.com/support/helpGuides/nt8/NT%20HelpGuide%20English.html?considerations_for_c ompiled_assemblies.htm

                  Here is an example to identify Extended Lines:

                  Code:
                  foreach (dynamic line in DrawObjects.ToList())
                  {
                       // Use ToString().Equals() to detect the object's Type
                       if (line.ToString().Equals("NinjaTrader.NinjaScript.D rawingTools.ExtendedLine"))
                       {
                            // Access the object by assuming that it is the Type we expect
                            Print(String.Format("ExtendedLine Line {0} detected!", line.Tag));
                        }
                  }​​

                  See the following thread for for more about this issue https://forum.ninjatrader.com/forum/...41#post1102141
                  Last edited by trader-ap; 07-31-2024, 03:41 PM.

                  Comment

                  Latest Posts

                  Collapse

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