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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        152 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        87 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        131 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        127 views
        1 like
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        106 views
        0 likes
        Last Post CarlTrading  
        Working...
        X