Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Condition for new Session start

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

    Condition for new Session start

    My backtest program recalculates variables whenever a new Session starts, for historical bars.

    Is there a straightforward way to specify this condition?

    Thanks.


    Condor Alpha Asset Management

    #2
    Hello yubo27,

    You can you the "Bars.FirstBarOfSession" to be able to find out which bar is the start of a new session.
    http://www.ninjatrader.com/support/h...rofsession.htm
    JCNinjaTrader Customer Service

    Comment


      #3
      Condition if(Bars.FirstBarOfSession) in OnBarUpdate gives error "Cannot convert method group 'IsFirstBarOfSession' to non-delegate type 'bool'. Did you intend to invoke the method? CS0428".

      What's the correct way to refer to Bars object in OnBarUpdate ?

      Comment


        #4
        Got it.

        Bars.IsFirstBarOfSession(0)

        Comment


          #5
          Hello yubo27,

          You can do the following statement:

          Code:
          // At the start of a new session
          if (Bars.FirstBarOfSession)
          {
          	//Do something
          }
          The following link you may use as a reference that uses the "Bars.FirstBarOfSession".

          http://www.ninjatrader.com/support/f...ead.php?t=4084
          JCNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          647 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          369 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          108 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          572 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          573 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X