Announcement

Collapse
No announcement yet.

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 muratb35, Today, 03:36 AM
          0 responses
          4 views
          0 likes
          Last Post muratb35  
          Started by fernlicht, Today, 02:16 AM
          2 responses
          13 views
          0 likes
          Last Post fernlicht  
          Started by fernlicht, 04-12-2021, 06:01 PM
          1 response
          29 views
          0 likes
          Last Post NinjaTrader_PaulH  
          Started by memonolog, Today, 02:10 AM
          3 responses
          10 views
          0 likes
          Last Post memonolog  
          Started by orenytz, Today, 12:25 AM
          0 responses
          10 views
          0 likes
          Last Post orenytz
          by orenytz
           
          Working...
          X