• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Detect New Session for OHL Indicator

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

    Detect New Session for OHL Indicator

    I am using a custom session template so that my chart automatically shows 2 sessions for each day. The first session is the overnight session and the second is the pit session.

    I am modifying the CurrentOHL indicator to show additional information. However, the indicator does not recognize the 2 session day. I need the calculations to start from scratch when the new session begins.

    I assume that this is the line that needs to be changed:

    if (currentDate != Bars.GetTradingDayFromLocal(Time[0]) || currentOpen == double.MinValue)

    I need it to look for a session change, not a date change.

    Thanks

    #2
    I changed the line above to

    if (Bars.FirstBarOfSession || currentOpen == double.MinValue)

    and this works perfectly, detecting the session change, not the date change.

    Now, is there any way to stop that ugly vertical line from drawing at the beginning of a new session when all the lines that were plotted in the prior session get re-set to the opening levels of the new session?

    For example, if the previous high was 100 and the new session starts at 90, a vertical line is drawn from the previous high to the current high. I've seen this on indicators before and it is very ugly, especially when you have multiple lines being reset.

    Comment


      #3
      You could have a look at the SessionPivots that can be downloaded here:

      http://www.ninjatrader.com/support/f...d=4&linkid=343

      The indicators are designed for use with 2 or 3 sessions per day.

      I personally prefer 3 sessions

      - night session (for ES 5:00 PM CT to 8:30 AM CT)
      - regular session (for ES 8:30 AM CT to 3:15 PM CT)
      - remaining trading time (for ES 3:30 PM to 4:15 PM CT)

      This aligns the session templates to the contractual trading day, which is absolutely necessary for a number of indicators. I have described the session templates in detail. Please follow the link below:

      https://www.bigmiketrading.com/elite...ur-charts.html

      Attached is a screenshot that displays the regular session high and low with additional information.
      Attached Files

      Comment


        #4
        Hello nedrob519,

        Thank you for your post.

        To disable the Session Break Line, right click in your chart > select Data Series > set Plot Session Break Line to False > OK.
        Patrick H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by moyerchopra, Yesterday, 11:43 PM
        0 responses
        1 view
        0 likes
        Last Post moyerchopra  
        Started by ttodua, Yesterday, 11:40 PM
        0 responses
        1 view
        0 likes
        Last Post ttodua
        by ttodua
         
        Started by edmata1109, 12-04-2019, 09:19 PM
        8 responses
        28 views
        0 likes
        Last Post koganam
        by koganam
         
        Started by maindoor, 12-03-2019, 10:45 PM
        9 responses
        63 views
        0 likes
        Last Post koganam
        by koganam
         
        Started by w0lverine, Yesterday, 08:22 PM
        0 responses
        1 view
        0 likes
        Last Post w0lverine  
        Working...
        X