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 CaptainJack, 05-29-2026, 05:09 AM
    0 responses
    238 views
    0 likes
    Last Post CaptainJack  
    Started by CaptainJack, 05-29-2026, 12:02 AM
    0 responses
    152 views
    0 likes
    Last Post CaptainJack  
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    163 views
    1 like
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    246 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    199 views
    0 likes
    Last Post CarlTrading  
    Working...
    X