Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

IDrawObject ChartAnchor question.

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

    IDrawObject ChartAnchor question.

    Probably a really simple one here...

    I have drawn a line and unlocked it allowing the user to drag it to wherever they chose

    IDrawingTool myLine;
    myLine = Draw.VerticalLine(this,"TheLine",5,Brushes.Black);//.IsLocked = false;
    myLine.IsLocked = false;

    Now I want to read the Time based location of that line.

    Based on the NT8 help guide the time value should be stores in <ChartAnchor>.Time

    Not being a professional coder I dont understand why ChartAnchor is shown int <>'s

    I would have thought the code should look like this, but i am obviously wrong.

    Print ("my Line anchor time = "+myLine.ChartAnchor.Time);

    The Help Guide also shows this example which would suffice
    Print(myText.Anchor.DrawnOnBar);

    although, the "Anchor" property doesnt exist when typing "myLine....." on the "Anchors" property which has no reference to Bars or Time in it.

    #2
    Hello marty087,

    Thank you for your note.

    You can loop through the anchors to find the time. Below is an example you could place directly below your code:
    Code:
    			if (myLine == null)
    				return;
    			
    			foreach (ChartAnchor anchor in myLine.Anchors)
    			{
    				Print(anchor.Time);
    			}

    Comment


      #3
      You can also look at our Anchors documentation at the following link: http://ninjatrader.com/support/helpG...us/anchors.htm

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      657 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      373 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      109 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      574 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      579 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X