Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to get information of a Drawingtool

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

    How to get information of a Drawingtool

    Hi guys,
    Well, I tried to find some information and try to do as much as possible on my end, but I can't. A little context. I have an indicator that creates lines at different prices. Everything is automated. It's a third-party indicator, so I can't access the code, I developed some code to just filter the drawing that is importart for me, but just get Name and tag that help a lot but for example I need to esential thing, startAnchor time and startAnchor price, but I Can't find the way can you please help me with this and i want to know if this one is the correct way thanks.

    region Get the draws
    // Verificamos si ChartControl está disponible
    if (ChartControl == null || ChartControl.ChartPanels == null || ChartControl.ChartPanels.Count == 0)
    return;


    // Recorremos todos los objetos de dibujo en el gráfico actual
    foreach (var drawingTool in DrawObjects)
    {
    // Intentamos convertir el objeto a una herramienta de dibujo
    var tool = drawingTool as DrawingTool;


    if (tool != null)
    {

    if( tool.IsAttachedToNinjaScript)
    {
    if(tool.Tag.Contains("[LuxAlgo] PineLib Line"))
    {
    Print("Drawing Tool: " + tool.Name);
    Print("Tag: " + tool.Tag);
    Print("Attached to:" + tool.AttachedTo.AttachedToType);
    Print("Drawn By:" + tool.DrawnBy);


    }
    }

    }
    }
    #endregion​​

    #2
    Hello FernandoParra,

    Thank you for your reply.

    If this came from a 3rd party source, I would highly recommend contacting the author or vendor that has distributed this to you for assistance using their software.

    In the code of the drawing tool the developer will have chosen names for the anchors. They may have used StartAnchor, EndAnchor, or they may have used completely different names.

    The Intelliprompt might help. If you type the variable holding the class and type a period . the list of available properties and methods for this object type will appear. Look for any properties with the name Anchor in them.


    That said, the suggested code looks pretty good accessing the drawing objects. I see this is first checking if the object was drawn by a script.

    I would recommend using .ToList() over the DrawingObjects collection to prevent collision errors.


    foreach (DrawingTool draw in DrawObjects.ToList())


    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi chelsea Thanks for your response, well my idea was just get the info from the chart, I don't want to get the info directly from the indicator because I dont have access to the code and the dev never responded my message,so, I get a list of the the draws in the chart then I filtered with this IsAttachedToNinjaScript, also can I filtered with the name of the tag of the draw but on that point when I'm on the if that filter , can I just convert tool(drawingTool ) to a drawobject or something? I check this info https://ninjatrader.com/support/helpGuides/nt8/NT%20HelpGuide%20English.html?drawingtools_drawobj ects.htm , and in the last grid they have something of ChartAnchor Properties
      and have this properties <ChartAnchor>.Price , <ChartAnchor>.Time, any way to do that ?​

      Comment


        #4
        Hello FernandoParra,

        Yes, the help guide page I've linked shows looping through the DrawObjects.ToList() and casting the object as it's type and printing the StartAnchor.SlotIndex.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        20 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        119 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        63 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        41 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        45 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X