Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Getting the DrawingTools region end price

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

    Getting the DrawingTools region end price

    Hi,

    I am trying to get the end (current) price of a drawn region, but it always returns 0. The region is drawn by a custom indicator, an anchored VWAP.

    Currently I use this logic in OnBarUpdate():

    Code:
    if (DrawObjects.Count > 0)
    {[INDENT]foreach (DrawingTool draw in DrawObjects.ToList())
    {[/INDENT][INDENT=2]if (draw is DrawingTools.Region )
    {[/INDENT][INDENT=3]Print ("Tag name: "+draw.Tag);
    DrawingTools.Region temp = draw as DrawingTools.Region;
    
    Print("startYPrice: " + temp.StartAnchor.Price);
    Print("startXTime: " + temp.StartAnchor.Time);
    Print("endYPrice: " + temp.EndAnchor.Price);
    Print("endXTime: " + temp.EndAnchor.Time);
    Print("SlotIndex: " + temp.EndAnchor.SlotIndex);[/INDENT][INDENT=2]}[/INDENT][INDENT]}[/INDENT]
     }
    This returns:

    Code:
    Tag name: region1
    startYPrice: 0
    startXTime: 26-2-2021 0:02:00
    endYPrice: 0
    endXTime: 12-3-2021 9:10:00
    SlotIndex: 13789
    The EndAnchor.Price always seems to be 0.

    Any ideas how to get the end/current price data of the region?

    Would appreciate your help!

    André

    #2
    Hello AndreR,

    Thanks for your post and welcome to the NinjaTrader forums!

    That is the expected behavior.

    To get the start and end price you would have to query the series that the region uses to draw the region, at those start and stop times from the region.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    566 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    330 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    547 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    548 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X