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

Bar before last bar of session

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

    Bar before last bar of session

    Hello everyone, how can I get a bar before the last bar of the session?

    I need the condition run on a bar thah before the last bar of the session

    how to define it?

    #2
    Hello memonolog,

    Thanks for your post.

    There is the property Bars.IsLastBarOfSession that will work on Historical data and live bars if you are using Calculate.OnbarClose. https://ninjatrader.com/support/help...rofsession.htm

    If you are using Calculate.OnEachTick or Calculate.OnpriceChange, on live data, then you would need to use the session iterator according to this note: When running Calculate.OnEachTick / OnPriceChange, this property will always return true on the most current real-time bar since it is the last bar that is updating in the trading session. If you need to find a bar which coincides with the session end time, please use the SessionIterator.ActualSessionEnd.
    Reference: https://ninjatrader.com/support/help...sessionend.htm


    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_PaulH View Post
      Hello memonolog,

      Thanks for your post.

      There is the property Bars.IsLastBarOfSession that will work on Historical data and live bars if you are using Calculate.OnbarClose. https://ninjatrader.com/support/help...rofsession.htm

      If you are using Calculate.OnEachTick or Calculate.OnpriceChange, on live data, then you would need to use the session iterator according to this note: When running Calculate.OnEachTick / OnPriceChange, this property will always return true on the most current real-time bar since it is the last bar that is updating in the trading session. If you need to find a bar which coincides with the session end time, please use the SessionIterator.ActualSessionEnd.
      Reference: https://ninjatrader.com/support/help...sessionend.htm

      the question was about how to get the bar before the last bar of the session

      So will I get the bar before the last bar of the session?

      if(Bars.IsLastBarOfSession)

      {
      Close[1]
      }

      Comment


        #4
        Hello memonolog,

        Thanks for your reply.

        What type of bars and bar size are you using?

        What Calculate setting are you using on the indicator?

        Does the indicator have any added data series?

        Can you provide context about what you are wanting to do?
        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by f.saeidi, Today, 12:14 PM
        7 responses
        16 views
        0 likes
        Last Post f.saeidi  
        Started by Russ Moreland, Today, 12:54 PM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by philmg, Today, 12:55 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_ChristopherJ  
        Started by TradeForge, 04-19-2024, 02:09 AM
        2 responses
        32 views
        0 likes
        Last Post TradeForge  
        Started by aprilfool, 12-03-2022, 03:01 PM
        3 responses
        329 views
        0 likes
        Last Post NinjaTrader_Adrian  
        Working...
        X