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 fwendolynlpxz, Today, 05:19 AM
        0 responses
        3 views
        0 likes
        Last Post fwendolynlpxz  
        Started by traderqz, Yesterday, 12:06 AM
        11 responses
        28 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by PaulMohn, Today, 03:49 AM
        0 responses
        8 views
        0 likes
        Last Post PaulMohn  
        Started by inanazsocial, Today, 01:15 AM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_Jason  
        Started by rocketman7, Today, 02:12 AM
        0 responses
        11 views
        0 likes
        Last Post rocketman7  
        Working...
        X