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

Current Range Bar possible High & Low Plot

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

    #31
    Originally posted by NinjaTrader_Austin View Post
    Just to check in, I'm running the code posted near the beginning and everything looks fine to me. Is this what you guys are getting?
    Yes...that is what is showing up. We just need the hash marks on the current bar only, not all the previous bars like you can see on your chart.

    Check out my post below to see how it seems to work perfectly on the ES chart but not on the TF.

    Comment


      #32
      Originally posted by Jason11 View Post
      Yes...that is what is showing up. We just need the hash marks on the current bar only, not all the previous bars like you can see on your chart.
      Just as Josh has stated in this thread multiple times, you can not "unset" a plot. If you want hash marks on the current bar only, do not use a plot--use DrawLine or DrawDot or something like that instead.
      AustinNinjaTrader Customer Service

      Comment


        #33
        I did change everything as per your suggestion to Drawing Lines instead of a Plot, but the same problem persisted in that sometimes it was fine and sometimes not.

        I take your suggestion about the Dot instead of a line if indeed it is not possible to position a line as one positions the Hash, although presumably somewhere there is coding that tells the Hash where to be plotted and if so, in theory, one should be able to replicate that with a line, no? If it is absolutely not possible, then okay, have to go with a dot. Problem with a dot: it is hard to see unless you make it big. A small but 2-thickness thick line works great, but much better as a hash mark centred above the current bar than a line drawn from the end of the last bar to the beginning of the current bar.

        I did not remove the return condition when I put in the Drawlines coding, although in theory that should not matter. But I will try without that condition to see if it makes a difference.

        The issue still remains: on many, many charts it works exactly as foreseen and desired, so even though you say it won't work, it actually does. But on some other charts it doesn't work. It would be nice to know the precise reason why sometimes it works and sometimes it doesn't rather than a general statement saying 'what you are doing is impossible' (even though most of the time it works fine).

        Comment


          #34
          well, I am just going to stick with the original version and use it for myself; it works 95% of the time fine. For charts where it doesn't work, won't use it.

          I don't see any difference in plotting a line versus a plot. Removing the conditional code doesn't make a difference when plotting a line except that it doesn't plot at all for some reason.

          So am sticking with the original and the problem will remain an unsolved mystery.

          Plotting a Dot doesn't centre it above. It just plots little dots in exactly the same place as it plots a dash or a line. Adding in a displacement of 1 makes no difference either.

          Pity: I think for those that trade with Range Bars this would be a handy addition. But unless the problem can be nailed down, it is not 100% consistent so cannot be recommended.
          Last edited by cclsys; 08-13-2009, 01:29 PM.

          Comment


            #35
            cclsys,

            Draw() methods will place the object exactly where you tell it to go in the y parameter.
            Josh P.NinjaTrader Customer Service

            Comment


              #36
              Originally posted by cclsys View Post
              well, I am just going to stick with the original version and use it for myself; it works 95% of the time fine. For charts where it doesn't work, won't use it.

              I don't see any difference in plotting a line versus a plot. Removing the conditional code doesn't make a difference when plotting a line except that it doesn't plot at all for some reason.

              So am sticking with the original and the problem will remain an unsolved mystery.

              Plotting a Dot doesn't centre it above. It just plots little dots in exactly the same place as it plots a dash or a line. Adding in a displacement of 1 makes no difference either.

              Cclsys,

              Hopefully we could get a solution to this...this is a great indicator for those of us who trade range bars. Thanks for your initial post!

              I have a proprietary indicator (subscription) that does this same type of thing but it plots the hash mark on an indicator rather than price (Desert Soft -Woodie CCI Pattern recog indicator)

              I know its possible for this to be done.... just cant figure it out.

              Comment


                #37
                Originally posted by NinjaTrader_Austin View Post
                Just to check in, I'm running the code posted near the beginning and everything looks fine to me. Is this what you guys are getting?
                If you are using the initial code you have to ensure that the Range Bar setting in the menu is the same as the one you plot. Looks like yours are not lined up.
                The second edition 'Auto' has the code seeing what the range bar setting is so you don't have to alter it manually.

                Comment


                  #38
                  Jason, thanks for encouragement. I too think this is worth getting right. It's not a big deal, but it is VERY handy.

                  For me there are two issues here:
                  1. Getting it right
                  2. Learning why it is not right and therefore simply: learning.

                  Thus far, unfortunately, we have not learned why on some charts it works exactly as it should and on others it doesn't. Clearly this is not a situation where what it being attempted is impossible because most of the time it works. Just sometimes it doesn't and we don't know why.

                  Josh: In terms of drawing it exactly where you want it: could you please supply a Drawline code example that plots a solid line in the same place as a Hash would be plotted? I have been unable to figure it out. If you place the first spot at 1 it starts at the previous bar. If you do 0....1 it doesn't plot at all. If you do 1....1, it doesn't plot. The only plot I get that works is 1...0 in which case it starts at 1 bar ago and ends up at the beginning of the current bar (as in plotting an indicator line). How to get it centred above the current plot eludes me. I have also tried 0.5's but it won't accept it.

                  I suspect that plotting a Hash is the way to go. The only issue is: how to get it to only plot on the current bar once the bar is complete. In working on this today I have put up several 2-range charts and seen the plots disappear AS SOON as the bar is complete, i.e. that very tick as it happens, so it doesn't need a second occurrence for the plot to be wiped out since in the code every time there is a new Close[0] the initial 'return' condition will erase the plot. Like I have said a few times, it works most of the time, but when it doesn't there is no apparent reason for it.

                  PS I now attach the latest Auto version with many lines disactivated but with both the Linedrawing and default Plot configurations just in case anyone on the forum wants to drill down into why there is this mysterious problem either way.
                  Attached Files
                  Last edited by cclsys; 08-13-2009, 02:01 PM.

                  Comment


                    #39
                    DrawLine(string tag, int startBarsAgo, double startY, int endBarsAgo, double endY, Color color)

                    DrawLine("line", 1, High[0], 0, High[0], Color.Blue)

                    The would draw a line segment at the current high price.
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #40
                      Originally posted by NinjaTrader_Josh View Post
                      DrawLine(string tag, int startBarsAgo, double startY, int endBarsAgo, double endY, Color color)

                      DrawLine("line", 1, High[0], 0, High[0], Color.Blue)

                      The would draw a line segment at the current high price.
                      Yes, starting at the previous bar and ending at the beginning of the current bar, right? Not like a Hash plot right?

                      That is what I had in the Drawing Plots.

                      But as mentioned elsewhere in this (irritating little!) thread, the same problem exists with the Drawing option as with the Hash option in that sometimes it seems to get it wrong. Now perhaps that is due to certain elements in my original coding which was set up around Plots (made transparent when trying the Draw Line options) but the question remains:

                      How do you tell a Line to plot in the same place as a Hash plot, i.e. centred over the current bar? Your example does not do that.

                      Comment


                        #41
                        You need to be more specific with what you mean by "goes wrong". Just draw the line and you will see how it behaves. Lines connect two data points together.

                        You should check your script for errors in the logs.
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #42
                          Originally posted by NinjaTrader_Josh View Post
                          You need to be more specific with what you mean by "goes wrong". Just draw the line and you will see how it behaves. Lines connect two data points together.

                          You should check your script for errors in the logs.
                          Thanks: the only error I can see is this one:
                          Error on calling the 'OnBarUpdate' method for indicator 'RangeBarProjectAuto' on bar 1644: Index was outside the bounds of the array.
                          That is from some time ago but that's the only one that came up today. I Have no idea what it means.

                          'goes wrong' means that old plots remain on old bars as shown in several pics on the thread.

                          To clarify : I attach a picture of it working well in that the current bar shows hash lines where the maximum possible high and low could end up, and no previous bars show anything. When you run it for a while and it is working, no previous bars show anything, only the current bar, and as soon as the Range Bar is 'complete', the hash lines go away. But sometimes they stay on the previous bars. That is the issue.

                          Secondary problem is : if switching to Drawline versus Plots, is there a way to get a line drawn in the same position as a Hash, i.e. centred, or even have it displaced one bar to the right/future? When I try displacing, there is no plot at all.
                          Attached Files
                          Last edited by cclsys; 08-13-2009, 02:20 PM.

                          Comment


                            #43
                            cclsys,

                            As stated, old plots DO NOT erase and SHOULD NOT erase. Once drawn they will stay drawn. It works the same how all other indicator plots work. If the plots are "erasing" that is erroneous and not the correct behavior.

                            The error you are receiving means you are accessing some value that does not exist and you need to address your code to fix it. The way to find where you are going wrong is to use try-catch blocks around places where you use [] index values. http://www.ninjatrader-support2.com/...ead.php?t=9825

                            No, DrawLine connects two points at the center, not a line across the center.
                            Josh P.NinjaTrader Customer Service

                            Comment


                              #44
                              Originally posted by NinjaTrader_Josh View Post
                              cclsys,

                              As stated, old plots DO NOT erase and SHOULD NOT erase. Once drawn they will stay drawn. It works the same how all other indicator plots work. If the plots are "erasing" that is erroneous and not the correct behavior.

                              The error you are receiving means you are accessing some value that does not exist and you need to address your code to fix it. The way to find where you are going wrong is to use try-catch blocks around places where you use [] index values. http://www.ninjatrader-support2.com/...ead.php?t=9825

                              No, DrawLine connects two points at the center, not a line across the center.
                              Josh: thanks. I will access that link to see if I can learn.

                              Could you please provide an example of a Drawline that ends up in the same position as a Hash Line Plot? Elsewhere you or Austin said you could get a Line to draw exactly where you say you want it. I want it the same as a Hash plot, i.e. centred above the current bar. Is that possible using the Draw language or not and if so, please provide an example. I suspect it is not possible but if it is am willing to try it.

                              Comment


                                #45
                                No. DrawLine() draws between two data points. From center mark to center mark. You can draw it exactly where you want based on the y-axis. Anywhere up or down. Left to right is determined by where the bars are.
                                Josh P.NinjaTrader Customer Service

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Aviram Y, Today, 05:29 AM
                                0 responses
                                2 views
                                0 likes
                                Last Post Aviram Y  
                                Started by quantismo, 04-17-2024, 05:13 PM
                                3 responses
                                25 views
                                0 likes
                                Last Post NinjaTrader_Gaby  
                                Started by ScottWalsh, 04-16-2024, 04:29 PM
                                7 responses
                                34 views
                                0 likes
                                Last Post NinjaTrader_Gaby  
                                Started by cls71, Today, 04:45 AM
                                0 responses
                                6 views
                                0 likes
                                Last Post cls71
                                by cls71
                                 
                                Started by mjairg, 07-20-2023, 11:57 PM
                                3 responses
                                216 views
                                1 like
                                Last Post PaulMohn  
                                Working...
                                X