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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    78 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    40 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    63 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    63 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    54 views
    0 likes
    Last Post CarlTrading  
    Working...
    X