Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SampleBreakOutStrategy

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

    SampleBreakOutStrategy

    Hello,
    In your SampleBreakOut Strategy I have a question.

    What is the minimun value for Bars.BarsSinceSession? Can it be 0? I mean if I write the following:

    if (Bars.BarsSinceSession = 0) is it the first bar of the session?

    Thanks

    #2
    dvercher,

    It is possible for BarsSinceSession to be 0. BarsSinceSession is the number of bars since the beginning of the session (e.g. trading day). As OnBarUpdate() is called for historical bars, BarsSinceSession will be incremented, resetting every new session.

    Please let me know if I may assist further.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Thank you for your answer, so if I just want to store the highest high from the first 2 bars, which one would be the correct one:

      Bars.BarsSinceSession < 1 (in the case 0 counts for the first bar, 1 will be the second)

      or

      Bars.BarsSinceSession < 2 (in the case 0 does not count for the first bar)

      Thanks

      Daniel

      Comment


        #4
        dvercher,

        Just doing a quick test printing Bars.BarsSinceSession, it goes 0,1,2,3,4,5,6,7,8,9,10,11,12 then repeats for my session so I'd imagine using <1 is the best option.

        Please let me know if I may assist further.
        Adam P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        599 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        344 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        103 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        558 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        557 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X