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

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 Rogers101, 05-05-2024, 11:30 AM
        22 responses
        66 views
        0 likes
        Last Post Rogers101  
        Started by reynoldsn, 05-04-2024, 02:34 PM
        2 responses
        24 views
        0 likes
        Last Post reynoldsn  
        Started by ttrader23, Today, 09:04 AM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by geotrades1, Today, 07:54 AM
        8 responses
        18 views
        0 likes
        Last Post geotrades1  
        Started by SnailHorn, Today, 08:38 AM
        1 response
        1 view
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X