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

LineBreak Close Times

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

    LineBreak Close Times

    Hello,

    I was wondering if there is a possible way to access the integer value of the close time of each line break bar. I understand that LB bars are independent of time and using traditional methods such as ToTime(Time[0]) will not work, but since the close times of each LB bar is displayed on the chart, I would assume there has to be some way to access these values.

    Thanks for the help!

    #2
    Hello,

    Although there is not any data inherent in the bars themselves that would provide info on the session break times, there are methods that can be used to determine the next session end time, which is the point at which the session break line will be plotted. Take a look at the info on Bars.Session below:

    http://www.ninjatrader.com/support/h...ml?session.htm

    Specifically, the GetNextBeginEnd() method should be exactly what you are looking for:

    http://www.ninjatrader.com/support/h...xtbeginend.htm

    Please let me know if I can assist further.
    Dave I.NinjaTrader Product Management

    Comment


      #3
      Dave,

      Thanks for the great idea. I'm having some difficulty implementing GetNextBeginEnd, however. When using the bar signature and adding ToTime(sessionBegin) and plotting the value, I notice that the session begin value is constant, regardless of the bar. Any idea why this may be happening? My code is straight out of the reference:

      Code:
      Bars.Session.GetNextBeginEnd(BarsArray[0], 0, out sessionBegin, out sessionEnd);
      Plot0.Set(ToTime(sessionBegin));

      Comment


        #4
        Hello,

        I believe that would be expected. GetNextBeginEnd() is returning a DateTime object, and ToTime() is extrapolating an integer value of the time only (not the date). The session start time itself should be the same in every session, only the date would change. Since the date is not parsed by ToTime(), then all you would see would be the time that each session begins, which should always be constant (unless you have set up a custom session template with different start/end times each day).
        Dave I.NinjaTrader Product Management

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by gravdigaz6, Today, 11:40 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by MarianApalaghiei, Today, 10:49 PM
        3 responses
        10 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by XXtrader, Today, 11:30 PM
        0 responses
        4 views
        0 likes
        Last Post XXtrader  
        Started by love2code2trade, Yesterday, 01:45 PM
        4 responses
        28 views
        0 likes
        Last Post love2code2trade  
        Started by funk10101, Today, 09:43 PM
        0 responses
        9 views
        0 likes
        Last Post funk10101  
        Working...
        X