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

Plotting lines (IB) from Friday into Sunday session?

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

    Plotting lines (IB) from Friday into Sunday session?

    Hi there,

    I downloaded Scott Daggett's "BzvOpeningRange3" indicator here

    This plots the highest high/lowest low of the first x minutes of the open, otherwise known as the Initial Balance (IB).
    It uses manually adjustable open and finish times, with the time to stop plotting. This takes into account a change of day which is why I like this indicator. I plot the cash session opening range into the following O/N session. This results in a plot jumping past midnight. Scott's code thus uses "AddDays" to make this work.

    Code:
    stopPlotDT = openDate.AddDays(1) + stopPlotTimeTS;
    
    // ie. adding an extra day to the date if it plots past midnight
    Obviously, for the sake of simplicity the code shown here is incomplete. However, what if I was to extend the opening range plot into the following week ie. Sunday's session? So I tried this:

    Code:
    if (Time[0].DayOfWeek == DayOfWeek.Friday)
    {
    	stopPlotDT = openDate.AddDays(2) + stopPlotTimeTS; [COLOR="SeaGreen"]// into Sunday[/COLOR]
    }
    else
    {
    	stopPlotDT = openDate.AddDays(1) + stopPlotTimeTS;
    }
    This is essentially plotting my levels from the Friday session into Sunday's. If you look at the picture below it does not work. I assume there is a "weekend issue" here just the same reason I cannot create a session template spanning Friday/Sunday in session manager. Any ideas to help? I'm open to any advanced concepts.

    Thanks a lot.

    Sim22
    Attached Files
    Last edited by Sim22; 09-21-2014, 02:35 AM.

    #2
    Hello Sim22,

    Thank you for your post.

    I am reviewing the code for the BzvOpeningRange3 indicator and will follow up here when I have information on your request.

    Comment


      #3
      Thanks Patrick, that's good of you.

      Just a side note. I trade the O/N session since I live in Oz. I find that in practice the O/N Session tends to respond to the previous cash session, where stops are taken out etc etc. on low volume. Most session templates, however, start the day's trading from the Asian open, finishing in the RTH. It would be nice to be able therefore to start a session template from Monday RTH, finishing on Sunday night/ Monday morning ETH. At present NT does not enable this since it cannot allow a change of week in the equation. I am therefore trying to set up my own daily bars starting at the cash session, with custom session template via custom indicators. I was wondering if you might pass this on for a fix in NT8

      Thanks again!
      Last edited by Sim22; 09-21-2014, 11:21 PM.

      Comment


        #4
        Hello Sim22,

        Thank you for your response.

        I will forward your suggestion to our development team.

        For the indicator, add the following to the beginning of the OnBarUpdate() method:
        Code:
        int days = 7 - Convert.ToInt32(Time[0].DayOfWeek);
        Then change the DrawLine()s so they read like the following:
        Code:
        					DrawLine("RangeHigh" + dateString, false, Time[CurrentBar - highBar], highestHigh, Time[0].AddDays(days+1), 
        					highestHigh, LineColor, LineStyle, LineThickness);
        					DrawLine("RangeLow" + dateString, false, Time[CurrentBar - lowBar], lowestLow, Time[0].AddDays(days+1), 
        					lowestLow, LineColor, LineStyle, LineThickness);

        Comment


          #5
          Thanks Patrick. Thanks for your suggestion!

          This did however cause IBs to be plotted over consecutive IBs as well. In other words there were up to 3 previous IB levels plotting on the current bar time.

          This is okay though, since I've often wondered how to plot multiple previous levels. So it might actually work in my favour

          Thanks again.

          Comment


            #6
            Hello Sim22,

            Thank you for your suggestion on how we can improve our product. It has been inserted into our tracking system with the unique ID # SFT-164.

            Comment


              #7
              I believe that the discussion here has gone into a false direction. I do not think that the session template needs to be changed. The session template should always reflect the contractual trading times of the instrument and not blend different pieces and bits of several trading days together.

              If you need an indicator that plots the opening range of the regular (or full) session of the prior day and plots that forward into the night session, then you just need to code it. The suggestion to use the prior day's high, low, settlement price and opening range as a reference for the night session makes sense. What does not make sense is to use a session template that runs over the weekend. This should be avoided in any case.

              (a) Indicator that plots regular high, low and close during the night session.

              This indicator already exists.



              You may set the pivot plots to transparent, but I would not do that.

              (b) Indicator that plots the opening range of the regular session of the prior day.

              I have coded an opening range indicator, which calculates the opening range from minute data which is loaded by the indicator (multi-timeframe version). This is necessary to show accurate opening range on charts built from ticks. It would be pretty easy to add three plots (prior day opening range high, low and regular open) which allow to display the prior day's opening range during the night session.

              I have attached a chart for illustration purposes.
              Attached Files

              Comment


                #8
                Here is just a chart with the Globex pivots added, which also displays the prior day's high, low and settelement price.
                Attached Files

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by GLFX005, Today, 03:23 AM
                0 responses
                2 views
                0 likes
                Last Post GLFX005
                by GLFX005
                 
                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
                7 views
                0 likes
                Last Post Waxavi
                by Waxavi
                 
                Started by TradeForge, Today, 02:09 AM
                0 responses
                14 views
                0 likes
                Last Post TradeForge  
                Started by Waxavi, Today, 02:00 AM
                0 responses
                3 views
                0 likes
                Last Post Waxavi
                by Waxavi
                 
                Working...
                X