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

plot line as stair steps (not)

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

    plot line as stair steps (not)

    hi, I have a line that that is kind of like a pivot point meaning that for a given session, the value is constant but between sessions its different.

    When I display it as a plot, I get a vertical line that connects the horizontal ones. Is there a way to configure the plot so that it does not draw connecting lines when the value changes between sessions?

    hope this makes sense.

    Onn

    #2
    Hello onnb1,

    Because this is a plot and not a line drawing object, you will need to not set the value of the plot for either the last bar of the session or first bar of the session to prevent the plot from connecting between these points.

    Please let me know if this does not resolve your inquiry.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      You can solve this issue programmatically. There are two options

      (a) You can set the color of the plot to transparent for the first bar of the session, for example

      Code:
      if(FirstBarOfSession && 
            (Plots[0].PlotStyle == PlotStyle.Line || Plots[0].PlotStyle == PlotStyle.Square))
                 PlotColors[0][-Displacement] = Color.Transparent;
      (b) You can code a custom plot and draw the line such that it stops 3 or 5 pixels away from the session break

      Below is a chart showing the two available options.
      Attached Files

      Comment


        #4
        thanks Harry - with the custom plot, wouldn't 1 pixel be enough? Just trying to understand if there is a reason for 3-5?

        Onn

        Comment


          #5
          Originally posted by onnb1 View Post
          thanks Harry - with the custom plot, wouldn't 1 pixel be enough? Just trying to understand if there is a reason for 3-5?

          Onn
          It looks better.

          Comment


            #6
            Originally posted by onnb1 View Post
            hi, I have a line that that is kind of like a pivot point meaning that for a given session, the value is constant but between sessions its different.

            When I display it as a plot, I get a vertical line that connects the horizontal ones. Is there a way to configure the plot so that it does not draw connecting lines when the value changes between sessions?

            hope this makes sense.

            Onn
            On the first bar of the new session Plot, reset the previous bar Plot.
            Code:
             
            if (FirstBarOfNewPlot)
            {
            Plot0.Set(PlotValue);
            Plot0.Reset(1);
            }

            Comment


              #7
              Originally posted by koganam View Post
              On the first bar of the new session Plot, reset the previous bar Plot.
              Code:
               
              if (FirstBarOfNewPlot)
              {
              Plot0.Set(PlotValue);
              Plot0.Reset(1);
              }

              If you wish to access that indicator from another indicator, you will then have bars without an indicator value that can be referenced. You may also experience a problem with a custom plot.

              I would not recommend that solution. If it is for visual purposes only (no connector) than visual tools should be used without changing the values of the underlying data series.

              Comment


                #8
                Originally posted by Harry View Post
                If you wish to access that indicator from another indicator, you will then have bars without an indicator value that can be referenced. You may also experience a problem with a custom plot.

                I would not recommend that solution. If it is for visual purposes only (no connector) than visual tools should be used without changing the values of the underlying data series.
                I agree with you somewhat, but I think your argument is the wrong way around. If the purpose is strictly and only visual, the we need to use the simplest method to achieve an objective where the underlying values, if not displayed, are not relevant, as they are not going to be accessed from anywhere else.

                Comment


                  #9
                  Did you look at NT's Pivot indicator code?



                  Originally posted by onnb1 View Post
                  hi, I have a line that that is kind of like a pivot point meaning that for a given session, the value is constant but between sessions its different.

                  When I display it as a plot, I get a vertical line that connects the horizontal ones. Is there a way to configure the plot so that it does not draw connecting lines when the value changes between sessions?

                  hope this makes sense.

                  Onn

                  Comment


                    #10
                    Originally posted by koganam View Post
                    I agree with you somewhat, but I think your argument is the wrong way around. If the purpose is strictly and only visual, the we need to use the simplest method to achieve an objective where the underlying values, if not displayed, are not relevant, as they are not going to be accessed from anywhere else.
                    If you wish to access the indicator from another indicator or strategy, you will have a problem with your version. It has an in-built trap.

                    Also your solution will create an unnessary gap at the end of the prior session. So your gap is twice as large as needed.

                    I insist that it is a bad choice for several reasons!

                    Comment


                      #11
                      Originally posted by Harry View Post
                      If you wish to access the indicator from another indicator or strategy, you will have a problem with your version. It has an in-built trap.
                      I think we just said the same thing, did we not? I said that I agree with you that if you want to access values, then there is a problem; if it is only visual there is not one, as we are looking only at the eye-candy? No?
                      Also your solution will create an unnessary gap at the end of the prior session. So your gap is twice as large as needed.
                      You lost me there. There will be no created gap. Visually, all that happens is the removal of a connecting data point. That cannot introduce a gap that is not already there.
                      I insist that it is a bad choice for several reasons!
                      Again, agreed. It is not the best choice for all situations. It is a very valid choice if visual appearance is the only criterion, which is what the OP posited.

                      Comment


                        #12
                        Originally posted by koganam View Post
                        You lost me there. There will be no created gap. Visually, all that happens is the removal of a connecting data point. That cannot introduce a gap that is not already there.
                        It is just a little detail. With PlotStyle line or square, if you take away one data point, you also take away the connector to the left bar and the connector to the right bar. Therefore the gap reaches from the second but the last bar of the old session to the first bar of the new session.

                        With the solution of setting the plot to transparent you only suppress the right connector, but you keep the left connector and the last (final) value of the prior session. The size of the gap now reaches from the last bar of the old session to the first bar of the new session. The gap is smaller. Half Size!

                        I agree that this is not a very serious discussion, and also I would like to mention that I have a great respect for all your contributions here on the forum. For me you are one of the known unknowns.

                        Comment


                          #13
                          Originally posted by Harry View Post
                          ... With the solution of setting the plot to transparent you only suppress the right connector, but you keep the left connector and the last (final) value of the prior session. The size of the gap now reaches from the last bar of the old session to the first bar of the new session. The gap is smaller. Half Size!
                          The explanation is taken and undertstood, but the conclusion may not be quite correct. Your conclusion on how the gap is affected assumes a monotonically increasing Plot.

                          The best we can say is that the gap is most probably going to be affected, as the only time that it will not be, is if the penultimate and ultimate values, of the prior session, are equal.

                          If the penultimate value is higher than the ultimate value, and there is a gap up, the gap shown will actually look smaller. On the other hand if the ultimate value is the bigger value, on a gap up, the gap will actually look bigger. The converse is obvious. The variation will not necessarily be a factor of 2.
                          I agree that this is not a very serious discussion, and also I would like to mention that I have a great respect for all your contributions here on the forum. For me you are one of the known unknowns
                          Thanks, those are kind words indeed. If I may say so, I too have great respect for your skills.
                          Last edited by koganam; 04-18-2013, 06:23 PM. Reason: Corrected grammar.

                          Comment


                            #14
                            Originally posted by sledge View Post
                            Did you look at NT's Pivot indicator code?
                            Actually I did - I had a peak. I saw that the pivots indicator only plots for the last day - perhaps am I missing something?

                            Onn

                            Comment


                              #15
                              Originally posted by Harry View Post
                              I agree that this is not a very serious discussion, and also I would like to mention that I have a great respect for all your contributions here on the forum. For me you are one of the known unknowns.
                              Thanks for answering and posing your different views. There is no one way to do anything and its always a trade off in finding the best design for your own specific circumstances. Your comments and "debate", when read by 3rd person like me, reveals information that helps make more educated decision for my needs - thanks!

                              Onn

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by algospoke, Yesterday, 06:40 PM
                              2 responses
                              19 views
                              0 likes
                              Last Post algospoke  
                              Started by ghoul, Today, 06:02 PM
                              3 responses
                              14 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by jeronymite, 04-12-2024, 04:26 PM
                              3 responses
                              44 views
                              0 likes
                              Last Post jeronymite  
                              Started by Barry Milan, Yesterday, 10:35 PM
                              7 responses
                              20 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by AttiM, 02-14-2024, 05:20 PM
                              10 responses
                              180 views
                              0 likes
                              Last Post jeronymite  
                              Working...
                              X