Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 Vitamite, Yesterday, 12:48 PM
    3 responses
    17 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by aligator, Today, 02:17 PM
    0 responses
    11 views
    0 likes
    Last Post aligator  
    Started by lorem, 04-25-2024, 09:18 AM
    22 responses
    95 views
    0 likes
    Last Post lorem
    by lorem
     
    Started by sofortune, Today, 10:05 AM
    3 responses
    16 views
    0 likes
    Last Post NinjaTrader_ChristopherJ  
    Started by ETFVoyageur, 05-07-2024, 07:05 PM
    23 responses
    185 views
    0 likes
    Last Post ETFVoyageur  
    Working...
    X