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

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:



      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:

      6E is an interesting instrument as you can trade the European or the US session. 6E moves in parallel with EURUSD, and the two instruments would have a different session setup, which does not really make sense. I have not solved the puzzle, and maybe it cannot be solved, but I want to present the different options. I start with the sessions derived from the floor trading hours for 6E and the Globex Session. Asiian and European Session 5:00 PM CT - 7:20 AM CT Floor Session 7:20 AM CT - 2:00 PM CT After-Session …


      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.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by XXtrader, Yesterday, 11:30 PM
        2 responses
        11 views
        0 likes
        Last Post XXtrader  
        Started by Waxavi, Today, 02:10 AM
        0 responses
        6 views
        0 likes
        Last Post Waxavi
        by Waxavi
         
        Started by TradeForge, Today, 02:09 AM
        0 responses
        11 views
        0 likes
        Last Post TradeForge  
        Started by Waxavi, Today, 02:00 AM
        0 responses
        2 views
        0 likes
        Last Post Waxavi
        by Waxavi
         
        Started by elirion, Today, 01:36 AM
        0 responses
        7 views
        0 likes
        Last Post elirion
        by elirion
         
        Working...
        X