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 Mestor, 03-10-2023, 01:50 AM
          16 responses
          388 views
          0 likes
          Last Post z.franck  
          Started by rtwave, 04-12-2024, 09:30 AM
          4 responses
          31 views
          0 likes
          Last Post rtwave
          by rtwave
           
          Started by yertle, Yesterday, 08:38 AM
          7 responses
          29 views
          0 likes
          Last Post yertle
          by yertle
           
          Started by bmartz, 03-12-2024, 06:12 AM
          2 responses
          22 views
          0 likes
          Last Post bmartz
          by bmartz
           
          Started by funk10101, Today, 12:02 AM
          0 responses
          7 views
          0 likes
          Last Post funk10101  
          Working...
          X