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 AaronKoRn, Today, 06:28 AM
          0 responses
          2 views
          0 likes
          Last Post AaronKoRn  
          Started by pjsmith, Today, 01:00 AM
          1 response
          12 views
          0 likes
          Last Post NT-Roland  
          Started by alejandro888, Yesterday, 08:41 PM
          0 responses
          9 views
          0 likes
          Last Post alejandro888  
          Started by UltraNIX, Today, 02:14 AM
          0 responses
          9 views
          0 likes
          Last Post UltraNIX  
          Started by augustfay, Yesterday, 12:06 PM
          1 response
          13 views
          0 likes
          Last Post NinjaTrader_Jason  
          Working...
          X