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

Finding the Timestamp for Current Day High

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

    Finding the Timestamp for Current Day High

    Sorry for the post but I am racking my brain trying to figure out how to do this and I think there is an easy way. I know how to get the value for the current day high or low (via the CurrentDayOHL() and I know that the GetBar can return the number of bars ago for a specific time stamp, but I cannot figure out how to retrieve the the time stamp for when the CurrentDayOHL.CurrentHigh[0] occurred (or the time stamp for any other indicator, for that matter)

    I did read the script on Getting indicator values from a specified time but I am still at a loss.

    Thanks for the help,I really appreciate it

    #2
    Hello Eurostoxx trader,

    You'll probably want to look at this reference sample:
    Calculating the highest high or lowest low for a specified time range

    The key value you would want from this sample is startBarsAgo.

    You could then plug this value into HighestBar() lookback period.

    That returns the number of bars ago that the highest high occurred for the lookback. This can go into your Time[ ] index.

    barsAgoHigh = HighestBar(High, startBarsAgo);
    myDateTime = Time[barsAgoHigh];
    Last edited by NinjaTrader_RyanM1; 09-14-2010, 04:10 PM.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the reply, I used the following code to get the session high and it works fine

      Code:
        barsAgoHigh = HighestBar(High, Bars.BarsSinceSession -1);
        myDateTime = Time[barsAgoHigh];

      Comment


        #4
        Excellent. Thanks for sharing your solution. It is definitely a lot simpler.
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by aussugardefender, Today, 01:07 AM
        0 responses
        3 views
        0 likes
        Last Post aussugardefender  
        Started by pvincent, 06-23-2022, 12:53 PM
        14 responses
        238 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Started by TraderG23, 12-08-2023, 07:56 AM
        9 responses
        384 views
        1 like
        Last Post Gavini
        by Gavini
         
        Started by oviejo, Today, 12:28 AM
        0 responses
        4 views
        0 likes
        Last Post oviejo
        by oviejo
         
        Started by pechtri, 06-22-2023, 02:31 AM
        10 responses
        125 views
        0 likes
        Last Post Leeroy_Jenkins  
        Working...
        X