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 Hwop38, 05-04-2026, 07:02 PM
        0 responses
        161 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        310 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        245 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        350 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        179 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Working...
        X