Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to Iterate through user drawn vertical lines and get their properties

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

    How to Iterate through user drawn vertical lines and get their properties

    What's the syntax for iterating through the user drawn vertical lines on a chart to print the tags, and horizontal locations. of all of those lines?
    Have been able to get the tags, but not the locations, either as date times or bar numbers.
    Thanks in advance.

    #2
    Hello Ricam,

    Thanks for your post.

    For an example, please see the help guide here: https://ninjatrader.com/support/help...rawobjects.htm

    The 2nd example provides a clue on how to access the anchor points.

    I don't have an example for vertical lines but perhaps this one for rectangles will help:

    Code:
     if (DrawObjects.Count > 0)
    {
    foreach (DrawingTool draw in DrawObjects.ToList())
    {
    if (draw is DrawingTools.Rectangle )
    {
    Print ("Tag name: "+draw.Tag);
    DrawingTools.Rectangle temp = draw as DrawingTools.Rectangle;
    
    Print("startYPrice: " + temp.StartAnchor.Price);
    Print("startXTime: " + temp.StartAnchor.Time);
    Print("startXBarsAgo: " + (CurrentBar - temp.StartAnchor.SlotIndex));
    Print("endYPrice: " + temp.EndAnchor.Price);
    Print("endXTime: " + temp.EndAnchor.Time);
    Print("endXbarsago: " + (CurrentBar - temp.EndAnchor.SlotIndex));
    }
    }
    }
    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by JT2020, Today, 04:23 AM
    0 responses
    1 view
    0 likes
    Last Post JT2020
    by JT2020
     
    Started by aslane, Today, 02:50 AM
    0 responses
    3 views
    0 likes
    Last Post aslane
    by aslane
     
    Started by fx.practic, Today, 02:07 AM
    2 responses
    10 views
    0 likes
    Last Post fx.practic  
    Started by Ousher, Today, 01:29 AM
    0 responses
    9 views
    0 likes
    Last Post Ousher
    by Ousher
     
    Started by tonynt, Today, 01:23 AM
    0 responses
    4 views
    0 likes
    Last Post tonynt
    by tonynt
     
    Working...
    X