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

Priordaysession issue

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

    Priordaysession issue

    Hi,

    I would like to know if the equivalent of tradestation's functions HighD,CloseD etc... are priorDaysessionHOLC.

    for example if I write "PriorDayOHLC().PriorOpen[3]", does it mean the open 4 days ago ?

    #2
    No it does not mean the prior day 4 bars ago. That would mean looking at 3 bars ago and then getting the prior day's values in relation to those 3 bars ago.

    You would want to use this in conjunction with GetBar() to go to previous sessions and then get the prior day from that previous session and keep moving back to get older and older values.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Could you please explain a little bit the trick with getbar...I'm afraid I do not understand ?

      Comment


        #4
        Baba, if you want to get the bar number for a specific date and time, you can use the GetBar() function.

        It takes a DateTime structure as input, and gives you the first bar that happened after that DateTime. For example, if you wanted the open of first bar at the open (9:30AM) for July 20 you could do this:
        Code:
        int barsAgo = GetBar(new DateTime(2009, 7, 20, 9, 30, 0)); 
        Print("The open price on the 9:30 AM bar was: " + Open[barsAgo].ToString());
        AustinNinjaTrader Customer Service

        Comment


          #5
          So to tie the concept together.

          Code:
          int barsAgo = GetBar(new DateTime(2009, 7, 23, 9, 30, 0));
          Print("7/22/09 Open: " + PriorDayOHLC().PriorOpen[barsAgo]);
          
          int barsAgo2 = GetBar(new DateTime(2009, 7, 22, 9, 30, 0));
          Print("7/21/09 Open: " + PriorDayOHLC().PriorOpen[barsAgo2]);
          You use GetBar() to get the barsAgo that needs to be passed in to the PriorDayOHLC() to get you the OHLC of the date you are after.
          Josh P.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by GussJ, 03-04-2020, 03:11 PM
          15 responses
          3,271 views
          0 likes
          Last Post xiinteractive  
          Started by Tim-c, Today, 02:10 PM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by Taddypole, Today, 02:47 PM
          0 responses
          2 views
          0 likes
          Last Post Taddypole  
          Started by chbruno, 04-24-2024, 04:10 PM
          4 responses
          51 views
          0 likes
          Last Post chbruno
          by chbruno
           
          Started by TraderG23, 12-08-2023, 07:56 AM
          10 responses
          403 views
          1 like
          Last Post beobast
          by beobast
           
          Working...
          X