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 ZenCortexCLICK, Today, 04:58 AM
        0 responses
        5 views
        0 likes
        Last Post ZenCortexCLICK  
        Started by sidlercom80, 10-28-2023, 08:49 AM
        172 responses
        2,281 views
        0 likes
        Last Post sidlercom80  
        Started by Irukandji, Yesterday, 02:53 AM
        2 responses
        18 views
        0 likes
        Last Post Irukandji  
        Started by adeelshahzad, Today, 03:54 AM
        0 responses
        8 views
        0 likes
        Last Post adeelshahzad  
        Started by Barry Milan, Yesterday, 10:35 PM
        3 responses
        13 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Working...
        X