Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Tip: How to retrieve the last several bars of the prior session?

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

    Tip: How to retrieve the last several bars of the prior session?

    If you want to find the close price of the prior session, the easiest way is to use the GetSessionBar method by setting the barsAgo parameter to 1: Bars.GetSessionBar(1).Close.

    However, if you want to find the close price of last several bars of the prior session, you can take advantage of the BarsSinceSession property. Close[BarsSinceSession + 1] gives you the close price of the last bar, Close[BarsSinceSession + 2] the close price of the second last bar, etc.

    #2
    Thanks for the tip Eric. Indeed useful.
    Josh P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by b16_aln, Today, 05:15 AM
    0 responses
    1 view
    0 likes
    Last Post b16_aln
    by b16_aln
     
    Started by sidlercom80, Today, 04:57 AM
    0 responses
    4 views
    0 likes
    Last Post sidlercom80  
    Started by patricia70, Today, 03:57 AM
    0 responses
    5 views
    0 likes
    Last Post patricia70  
    Started by pjsmith, Today, 03:25 AM
    0 responses
    7 views
    0 likes
    Last Post pjsmith
    by pjsmith
     
    Started by cincai, Today, 01:04 AM
    1 response
    14 views
    0 likes
    Last Post NinjaTrader_Jason  
    Working...
    X