Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time of High bar within specific range

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

    Time of High bar within specific range

    Hello,

    Im currently grabbing the high and low bars within a specific range as follows:

    Code:
    if (Time[0] == startN)
    {
    nStart = CurrentBar-1;
    }
    
    if (Time[0] == Time[0].Date.AddHours(16))
    {
    nEnd = CurrentBar;
    nBars = nEnd-nStart;
    nHigh = HighestBar(High, nBars);
    nLow  = LowestBar(Low, nBars);
    }


    Than boxing those values within that range as follows
    Code:
    if (Time[0] == Time[0].Date.AddHours(16))
    {
    Draw.Rectangle(this, "Hi/Lo", false, startN, High[CurrentBar-(nEnd-nHigh)], endN, Low[CurrentBar-(nEnd-nLow)], Brushes.Red, Brushes.Transparent, 0, true);
    }​

    No issues there, but what I am having difficulty with is printing the time of that bar that forms the high and low within that range. Any assistance would be appreciated, it doesnt have to coincide with the above method on pulling the high bar.
    Last edited by ChrisR; 05-20-2023, 08:16 PM.

    #2
    Nevermind, I was way overthinking this. This was accomplished by

    Code:
    if (Time[0] == Time[0].Date.AddHours(16))
    Print(Bars.GetTime(CurrentBar-nHigh));​

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    57 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    78 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    39 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    101 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    61 views
    0 likes
    Last Post PaulMohn  
    Working...
    X