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 ScottWalsh, Today, 06:52 PM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by ScottW, Today, 06:09 PM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by ftsc2022, 10-25-2022, 12:03 PM
        5 responses
        256 views
        0 likes
        Last Post KeyonMatthews  
        Started by Board game geek, 10-29-2023, 12:00 PM
        14 responses
        244 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by Waxavi, 04-19-2024, 02:10 AM
        4 responses
        56 views
        0 likes
        Last Post sonia0101  
        Working...
        X