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 WNorton, Today, 11:23 AM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_Spencer  
    Started by stafe, Today, 10:43 AM
    0 responses
    8 views
    0 likes
    Last Post stafe
    by stafe
     
    Started by UltraNIX, Today, 09:13 AM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_ChrisL  
    Started by Tuxstuff215, Today, 06:32 AM
    1 response
    15 views
    0 likes
    Last Post NinjaTrader_ChrisL  
    Started by carlot, Today, 08:10 AM
    2 responses
    22 views
    0 likes
    Last Post carlot
    by carlot
     
    Working...
    X