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

Draw lines between session breaks

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

    #16
    Hello,

    Thank you for the replies.

    Regarding the math lining up, are you certain the values being compared are the same the PriorDayOHLC is using?

    You could review the logic in this indicator to see how exactly it calculates the data, it is basically going to just be the OHLC of the bar series it is applied to. This would entail if you do not pass a secondary series but reference the values from the secondary series, it would be different. It is hard to say without seeing the specific test you had completed and the total syntax used.

    Regarding the syntax: PriorDayOHLC(Closes[1]).PriorHigh[0] "

    This is just using the second overload to provide a series to calculate the Prior day information on. The Add statement in Initialize would be related in the sense that you Add the second series to be able to use it. Closes[1] signifies the secondary close series.

    If you review the syntax in the PriorDayOHLC indicator, you will note that this indicator uses the Session specifically to determine what data is included. If you only want Monday - Friday specifically, you could create a custom session template that only includes these dates. Or not use the PriorDayOHLC and only get values of the Monday - Friday of the current week using logic. The PriorDayOHLC will create a continuous plot series of all Prior day OHLF values of the session template, if you only need the current weeks information it would potentially be easier to just reference that data specifically using logic in the current script.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #17
      I don't know what the heck is going on with my indicator so far but this is NOT what I expect to see drawn on my charts. http://screencast.com/t/bVGo0cwupro7

      As opposed to my "hand drawn" lines derived from my spreadsheet formulas. Notice how the market respects my support/resistance lines? http://screencast.com/t/CARzRL2d

      Best regards,

      Dolfan

      Comment


        #18
        Jesse,

        I am trying to understand all of your response but since I am not fully on board on board with all of the terminology, I still struggle.

        First off, no I am not sure about all of the values being compared. The indicator works off of day bars and the spreadsheet calculations work off of 1440 minute bars. I have learned earlier that these 2 bars will be calculated differently. Add in here the fact that Sundays are a "day 6" where as I only have 5 days in the mix seems to skew my data,

        Adding this statement Add(PeriodType.Minute, 1440); caused my indicator to stop painting lines so I suspect that I am missing something elsewhere that calls this period???

        How does one create a custom session template?

        At this point I am considering changing to a strategy that calls data and paints lines. I have been marginally successful with strategies so far and failing miserably at making an indicator, so far.

        Best regards,

        Dolfan

        Comment


          #19
          Hello,

          Thank you for the replies.

          Unfortunately without seeing the syntax you are trying it is hard to say why a specific set of results ended up that way. Could you provide the script for me to see what is being used?

          As far as Adding the series and having it disappear, it is likely you are getting an error in the log or output window related to indexing after adding the series, but again without the script it is hard to say.

          Custom session templates can be created with the Session Manger, you can find this in the helpguide here: http://ninjatrader.com/support/helpG...on_manager.htm


          I look forward to being of further assistance.
          JesseNinjaTrader Customer Service

          Comment


            #20
            Jesse,

            I removed the message to protect my work. I hope you got it in time. If not, let's work through private messaging or email.

            Dolfan

            Comment


              #21
              Originally posted by NinjaTrader_Jesse View Post
              Hello,

              If you review the syntax in the PriorDayOHLC indicator, you will note that this indicator uses the Session specifically to determine what data is included. If you only want Monday - Friday specifically, you could create a custom session template that only includes these dates. Or not use the PriorDayOHLC and only get values of the Monday - Friday of the current week using logic. The PriorDayOHLC will create a continuous plot series of all Prior day OHLF values of the session template, if you only need the current weeks information it would potentially be easier to just reference that data specifically using logic in the current script.

              I look forward to being of further assistance.
              Thanks for the Session instructional. I created my own Session Template called "Dolfan" and set the times of 1:00 am Monday to 3:05 pm Monday, then duplicated for Tuesday thru Friday and saved. Could I then replace the session callout

              if (Bars.FirstBarOfSession && sessionCount < 2) sessionCount++;

              with

              if (Bars.FirstBarOfSession && sessionDolfan < 2) sessionDolfan++;

              ...and after doing this, use the same syntax

              double high = (PriorDayOHLC() .PriorHigh[0] + PriorDayOHLC() .PriorHigh[1] +PriorDayOHLC() .PriorHigh[2] +PriorDayOHLC() .PriorHigh[3] +PriorDayOHLC() .PriorHigh[4] +PriorDayOHLC() .PriorHigh[5] +PriorDayOHLC() .PriorHigh[6] +PriorDayOHLC() .PriorHigh[7] +PriorDayOHLC() .PriorHigh[8] +PriorDayOHLC() .PriorHigh[9]) /10;

              ...and expect to call out only Monday thru Friday trade sessions?

              Thanks in advance.

              Best regards,

              Dolfan

              Comment


                #22
                Hello,

                I am sorry but I had not copied the file by the time it was removed.

                If you would like to work further through email we always can, you would just need to send an email to platformsupport[at]ninjatrader[dot]com. If so please attach the file in question and a link to this thread.

                Regarding the session usage, the existing session syntax would stay the same if you are just using a different session template. In the case you have created a custom session, you would set the Chart to use that session and then only the days for that session would be included in the data series. By default the <use instrument settings> will use the session defined in the Instrument manager for that instrument.

                I look forward to being of further assistance.
                JesseNinjaTrader Customer Service

                Comment


                  #23
                  Wow! That seems to have cleaned up a lot. I still see where the lines are not as accurate as I would like but the absence of Sunday data is no longer skewing the results

                  Free online storage and sharing with Screencast.com. 2 GB of storage and 2 GB of bandwidth per month for free. We won't compress, alter or take ownership of your content.


                  All of my email is on a MAC elsewhere so if I could send this in a private message off the Forum, I would appreciate it.

                  Best regards,

                  Dolfan

                  Comment


                    #24
                    OK Jesse, I have stumbled across the "Insert Code Snippet" option with this option;

                    DrawHorizontalLine("MyHorizontalLine", Close[0], Color.Blue);

                    Do you think this is what I should be using instead of a "Plot" and "PlotStyle.Line" command? I realize this will have me starting all over again but at this point I am ready to start from scratch.

                    Best regards,

                    Dolfan

                    Comment


                      #25
                      Hello,

                      Thank you for the replies.

                      Regarding private messages, we infrequently check the forum pm inbox so this is generally not a good option. If you do not have a web based email that you can access through any browser, you could also use the help -> mail to platform support option to send emails to platform support.

                      Regarding DrawHorizontalLine, this would draw a line that spans from the left of the chart to the right of the chart even across sessions. If this is what you would like you can certainly use this. If you were looking for the effect of how the lines are in the PriorDayOHLC or how they break at each day, this would not work for that use.

                      I look forward to being of further assistance.
                      JesseNinjaTrader Customer Service

                      Comment


                        #26
                        Jesse,

                        I am not sure if you remember working with me on this but I have discovered something perplexing. I am also kicking myself for not seeing it earlier.

                        The goal for developing this indicator was to paint lines daily based on historical performance of an instrument. For this process I was directed to use 1440 minute bars to grab the data. This is spelled out in the indicator. However, I am using renko bars to trade and a trigger based on this indicator. The renko bars chart shows a different location for all of the lines drawn. Why is this? Is there an error in the algo or does it need to be changed to used with renko bars?

                        I have attached this chart for your reference. https://www.screencast.com/t/hmc0ziT5dbht

                        Note that both of the minute charts show the same blue line or opening price for the day but the daily and the renko charts illustrate something completely different. Perhaps it has something to do with the session template? Your thoughts?

                        Dolfan

                        Comment


                          #27
                          Hello Dolfan,

                          Thank you for the post.

                          Based solely on the image, I would be unsure what may be occurring here. In the image you noted the prices were not showing up. It looks like the price marker color is set to the same color as the scale potentially, it seems there may be some text artifacts overlaid on some of the other visible markers that I can see. is this what you are asking about specifically?

                          Regarding the placement, this could be related to mixing tick and time series as Tick series such as renko do not have specific timestamps. I would expect that alone would cause different placement of objects depending on the logic being used to draw them.


                          I look forward to being of further assistance.
                          JesseNinjaTrader Customer Service

                          Comment


                            #28
                            Jesse,

                            I am not concerned about the price tags not being visible but I think your second paragraph touches on the problem. The goal was to measure trading ranges, (basically ATRs) for a specified time period, in this case 2 weeks. Because of session templates and such, we picked 1440 minute bars to measure with. I assumed by the fact that we specifically designated the time frame to be measured in the syntax, that the lines would be the same across all charts no matter their display. I guess I was wrong.

                            Specifically speaking, this indicator is a measure of ticks but over a specific period of time. How is it that using the indicator on a renko chart alters that measurement?

                            Dolfan

                            Comment


                              #29
                              Jesse,

                              Upon further review, some of my session templates were set at Default 24/7 and some were set at <Use Instrument Settings>. I changed them all to be the same and with the exception of the daily and 1440 minute charts, the lines all seem to match. This brings me to another question, the real question. I use these lines as triggers in a strategy. I do not see anywhere in the strategy where the session template is specified so how do I know how the strategy and indicator are measuring the price action? This might explain to me why entries sometimes leave me scratching my head wondering why it opened an order there instead of here. Thanks for your help!

                              Best regards,

                              Dolfan

                              Comment


                                #30
                                Hello Dolfan,

                                Thank you for the reply.

                                Yes, the session template makes sense that would totally change the output.

                                As far as how strategies select the session template, as you know you can apply a strategy to either a Chart or directly to the control center. When using a Chart it would be assumed from the series you apply it to. When applying from the control center, you can pick from a dropdown because you also have to pick the dataseries there. Sub-indicators would then inherit from the calling strategy.

                                I look forward to being of further assistance.
                                JesseNinjaTrader Customer Service

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Kaledus, Today, 01:29 PM
                                0 responses
                                3 views
                                0 likes
                                Last Post Kaledus
                                by Kaledus
                                 
                                Started by PaulMohn, Today, 12:36 PM
                                1 response
                                16 views
                                0 likes
                                Last Post NinjaTrader_Gaby  
                                Started by yertle, Yesterday, 08:38 AM
                                8 responses
                                36 views
                                0 likes
                                Last Post ryjoga
                                by ryjoga
                                 
                                Started by rdtdale, Today, 01:02 PM
                                1 response
                                6 views
                                0 likes
                                Last Post NinjaTrader_LuisH  
                                Started by alifarahani, Today, 09:40 AM
                                3 responses
                                18 views
                                0 likes
                                Last Post NinjaTrader_Jesse  
                                Working...
                                X