Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Finding First Bar of Region Highlight

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

    Finding First Bar of Region Highlight

    Hi Guys

    I have set up background colors in RegionHighLight. It is okay visually for testing but I would like to use the start bar / start time of some of the zones programically in another indicator. As the color regions adjust for DST and holidays I cant just nominate a time where each region starts. I assume the easiest way to do that is to find the first bar and do an ADDPLOT that I can reference in the other indicator. I have the code below set up for the color regions.

    for (int i = 0; i < AStructArray.Length; i++) // Color Time Regions - Set to plot repeatedly
    {
    Draw.RegionHighlightX(this, "TimeRegion" + Time[0].Date.ToString() + i, Time[0].Date + AStructArray[i].StartTime,
    Time[0].Date + AStructArray[i].EndTime, Brushes.Transparent, AStructArray[i].Color, AStructArray[i].AreaOpacity);
    }
    I can also set it up to draw a dot at one height througout (horizontal line of dots at the same LOW) which also cant be accessed programically, so looking to do something the same but as an ADDPLOT

    Draw.Dot(this, "StartTime" + Time[0].Date.ToString() + i, true, Time[0].Date + AStructArray[i].StartTime,
    Lows[0][0], Brushes.Blue, true);

    I have tried the following inside the above FOR loop which does not work correctly because I was trying to plot into the future using StartTime and using EndTime only plots once in the wrong location.

    if (i == 1)
    {
    chicStartTime = Time[0].Date + AStructArray[i].EndTime;
    barsAgoChicStart = CurrentBar - Bars.GetBar(chicStartTime);

    if (barsAgoChicStart == 0)
    {
    ChicStart[0] = Lows[0][0] - TickSize*25;
    }

    Can someone point me in the right direction because I am not sure if I am close or miles away from the correct method and code. Thanks.

    #2
    Hi Ray, thanks for posting.

    One way to do it would be looping through the DrawObjects collection to find RegionHiLight's that have a certain tag, and extract times and prices from the object's anchors, Alternatively, you can store each drawn object into a List<RegionHighlightX> collection and set this data to a Plot or Series<T> object. We have an example here on exposing indicator values that are not plots.

    Best regards,
    -ChrisL

    Comment

    Latest Posts

    Collapse

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