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

    #46
    Finally, to clarify this I attach 2 pics, one with it working one with it not, both from right now.

    Picture 1 ('RP not good') shows a TF 8 range with lots of previous bar plots.
    Picture 2 ( 'RP good') shows a TF 5 range with no previous (and none current as the bar is complete; there were plots before , but as soon as the bar completed they disappeared as should be the case).

    RP Good 7 range is the same chart as RP not good 8 range but changed to a 7-range chart. It is fine.
    Attached Files
    Last edited by cclsys; 08-13-2009, 02:38 PM.

    Comment


      #47
      Incorrect. You have historical hashes on both pictures. If you change the color you will see them very easily.

      Historical plot points do NOT disappear. Once you set them they will continue to plot. It works just like all other indicators. Please go try the SMA indicator for example. Switch the plot style to Hash and see all the historical hashes.
      Josh P.NinjaTrader Customer Service

      Comment


        #48
        Originally posted by NinjaTrader_Josh View Post
        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.
        Thanks. From reply I take it that you cannot use the Drawline language to effect a plot that is equivalent to a Hash line that is nicely centred above or below the current bar.

        It also seems that you cannot displace such line beyond the current bar, i.e. one (non-existent) bar to the right.

        So using the Plot functions seems to be the best way. The issue remains: why does it work perfectly well on some charts but not on others or even more specifically, why does it work perfectly well on the TF 7 bar range but not 8, not 9, not 10, but on 11 or 2 or 3?
        Last edited by cclsys; 08-13-2009, 02:43 PM.

        Comment


          #49
          Originally posted by NinjaTrader_Josh View Post
          Incorrect. You have historical hashes on both pictures. If you change the color you will see them very easily.

          Historical plot points do NOT disappear. Once you set them they will continue to plot. It works just like all other indicators. Please go try the SMA indicator for example. Switch the plot style to Hash and see all the historical hashes.
          There are NO historical hashes on the 'RP good' chart (nor for 90% of the charts when this indicator is applied). Can you see one? I can't.

          I understand about historical plots. But I have a condition:

          If the high-low = the range bar amount: return. So any time the range bar is completed, there is no plot. Most of the time it works. Sometimes it doesn't but when it doesn't it seems to happen again and again throughout the chart loaded, although sometimes it is on occasional bars.

          All you have to do is load it, try it on a few charts by changing the range bar amount. Doesn't take long to do. You will see that most of the time it works as it is supposed to - even though you say above that this is not possible - but on some charts it just doesn't work and again, sometimes it is every bar it doesn't work on, sometimes only occasional bars.

          Mystery!

          PS: on looking at the pics again I realised there might be confusion: there is a Donchian hash line plot on the not good charts, but this is a thinner line. The RProject lines are thick yellow and thick blue right on the bar lows or highs, not the other hashes that show trailing support/resistance. Sorry about that confusion.
          Last edited by cclsys; 08-13-2009, 02:56 PM.

          Comment


            #50
            Look. Change the colors and you will see exactly what I am talking about. I see thin blue hash marks on the chart you claim doesn't have any. Conditions do not matter. Once a plot is set. It is set. When condition becomes false it doesn't matter. The plot has already been set and will remain set.

            If you set the plot it will have the hashes. Its very simple. If you are using conditions to determine when to set, then it will simply draw the hashes whenever the condition is true. Once drawn, it is never removed. There is no "on now, off now" behavior. Once on it is always on.
            Josh P.NinjaTrader Customer Service

            Comment


              #51
              Originally posted by NinjaTrader_Josh View Post
              Look. Change the colors and you will see exactly what I am talking about. I see thin blue hash marks on the chart you claim doesn't have any. Conditions do not matter. Once a plot is set. It is set. When condition becomes false it doesn't matter. The plot has already been set and will remain set.

              If you set the plot it will have the hashes. Its very simple. If you are using conditions to determine when to set, then it will simply draw the hashes whenever the condition is true. Once drawn, it is never removed. There is no "on now, off now" behavior. Once on it is always on.
              Josh, I am not into arguing for the sake of it, but if you run this Indicator during a period when there is an active market (i.e. not now), you will see the plots disappearing, so what you say above is simply not accurate.

              'Once a plot is set. It is set. When condition becomes false it doesn't matter. The plot has already been set and will remain set.'

              Also, I don't have so much a 'condition' as a command: 'if the range bar is complete... return'. Now obviously it is not always working, but it is not true what you say that a plot cannot disappear after it has been plotted because it happens again and again if you use the indicator.

              What is not clear is why it works perfectly well on some charts and not on others. Your reply intimates that it is simply not possible for it to work, period.

              But most of the time it does, so this reply does not get to the actual question/issue.
              Last edited by cclsys; 08-13-2009, 03:20 PM.

              Comment


                #52
                Once a plot is set it is set. This is the proper behavior. Any behavior that is contrary to this is inaccurate behavior and you will need to examine your code to see what is causing it to go wrong. Your index out of range error just happens to be one capable of causing plots to disappear.
                Josh P.NinjaTrader Customer Service

                Comment


                  #53
                  Originally posted by NinjaTrader_Josh View Post
                  Once a plot is set it is set. This is the proper behavior. Any behavior that is contrary to this is inaccurate behavior and you will need to examine your code to see what is causing it to go wrong. Your index out of range error just happens to be one capable of causing plots to disappear.
                  Fine. Then I'll just leave it be as it is and when it works it is helpful and when it doesn't I will take it off the chart. I have no idea how to improve or fix it or further 'examine' it - which is why I brought this up here in the forum in the first place. We have been around several iterations and, after giving the code the ability to reference the Range Bar number which was very helpful, the original problem has remained throughout. If you say what I am attempting is impossible, I guess that is it, although I am still suspicious because most of the time it works exactly as intended, and only sometimes it doesn't.

                  I still think this would be a good thing for Ninja users to have - assuming it works properly - but if it is not possible to code to work in a consistent fashion, so be it. On the other hand, it is possible that I started this from the wrong end - using Plots or whatever - and someone else could come up with the right way to effect this Indicator working consistently, in which case - again - it would be helpful for anyone using Ninja to trade Range Bar charts.

                  Sorry for the trouble, just assumed this was a simple thing that could be easily addressed by those with more knowledge of Ninja scripting.
                  Last edited by cclsys; 08-13-2009, 03:27 PM.

                  Comment


                    #54
                    This is a simple thing

                    Ok here is a working version, as far as I can see. Just add serialized variables for color selections and you are good to go. Just a different approach was all it took.
                    Attached Files
                    eDanny
                    NinjaTrader Ecosystem Vendor - Integrity Traders

                    Comment


                      #55
                      eDanny. Thanks. That looks very promising - turning into text so it can be centred. I will run it tomorrow and see if it works consistently in live markets.

                      Why did you add in the if current bar < 1 ... return? What does that prevent? (Just trying to learn how to code better...)

                      Comment


                        #56
                        OK. I cleaned up the now defunct elements that you //'d out and also added in the ability to pick the colors.

                        I think I know the answer to this is 'no', but is it possible to make the -- bold? Apart from that, it looks fine, although again I'll have to wait for more active markets to ensure that it doesn't have the same problem as the original hash-plot approach.

                        ( I also added in the top line that EDanny helped - although of course so did NT Josh and NT Bernard! )

                        It is now called RangeBarHighLow and if it works I suspect will be used by many Range Bar traders (if there are many Range Bar traders?).

                        Attached the code + a picture of how it looks - albeit in superslow night-time mkt condition.
                        Attached Files
                        Last edited by cclsys; 08-13-2009, 11:15 PM.

                        Comment


                          #57
                          Originally posted by cclsys View Post
                          eDanny. Thanks. That looks very promising - turning into text so it can be centred. I will run it tomorrow and see if it works consistently in live markets.

                          Why did you add in the if current bar < 1 ... return? What does that prevent? (Just trying to learn how to code better...)
                          Sorry about the confusion but I had forgotten to comment out a few lines and got an error on the log tab, so I blindly added the CurrentBar < 1 line. I then saw the uncommented lines but forgot to eliminate the added line. As far as bold goes, you need to find a font that has a good looking bold character set and use it but you might have to play with the pixel offset.

                          Try "Franklin Gothic Heavy",18 with an offset of 4. It will be a solid thick line.
                          Last edited by eDanny; 08-14-2009, 06:57 AM.
                          eDanny
                          NinjaTrader Ecosystem Vendor - Integrity Traders

                          Comment


                            #58
                            OK guys. Running this, I found a problem. When the range bar "fills" the opposite mark still shows to be one more tick outside the existing bar. So for example if you have a 5 range bar and there are already 5 ticks, then the marks should be showing at the high of the bar and at the low of the bar.

                            This version still shows one of the marks another tick beyond the range, which is incorrect.

                            The original version by cclsys showed the marks correctly; when the range of the bar filled up then the marks would disappear. That works correctly because what we are looking for is to predict where the high and the low of the range bar will be.

                            Comment


                              #59
                              Sorry about that, text works different than plots. To fix it you need to eliminate this:

                              if ( High[0] == Low[0] + (Bars.Period.Value*TickSize) || (Low[0] == High[0] - (Bars.Period.Value*TickSize)) )
                              return;

                              The rest of the code should look like this:

                              if ( High[0] != Low[0] + (Bars.Period.Value*TickSize))
                              DrawText("PossHigh", true, "--", 0, Low[0]+ (Bars.Period.Value*TickSize), 4, Color.Goldenrod, new Font("Franklin Gothic Heavy",18), StringAlignment.Center, Color.Empty, Color.Empty, 10);
                              else
                              RemoveDrawObject("PossHigh");

                              if(Low[0] != High[0] - (Bars.Period.Value*TickSize))
                              DrawText("PossLow", true, "--", 0, High[0]- (Bars.Period.Value*TickSize), 4, Color.MediumBlue, new Font("Franklin Gothic Heavy",18), StringAlignment.Center, Color.Empty, Color.Empty, 10);
                              else
                              RemoveDrawObject("PossLow");

                              Now it will work fine.

                              (You can see in the second panel there is a Range countdown display. With it, you will always still see a 1 before the new bar since price needs to go the extra tick before changing bars)
                              Attached Files
                              Last edited by eDanny; 08-14-2009, 07:58 AM.
                              eDanny
                              NinjaTrader Ecosystem Vendor - Integrity Traders

                              Comment


                                #60
                                Thanks again Danny. I have loaded it just onto one chart and it seems fine although once the plots 'stuck' for a bar or two as I was switching around. My old version had many multiple plots today so this seems definitely better and changing the font was good.

                                As I changed indicators on the chart, they stuck again. So I changed the range bar number and it was fine. Then went back to the previous RB nr and it was still stuck on same bar where stuck before. So some little niggly thing is wrong and I suspect it has to do with what Josh or Bernard was saying that you can't unplot things once they are plotted even though in theory the code is telling it not to do that. And this is plotting something on a newly loaded chart on a previous bar, i.e. not the current bar. So something is being 'remembered' somewhere in the system and the code doesn't address this memory issue.

                                But I think we've done all that can be done with this little aid. Most of the time it works great and sometimes it likes to get temperamental. Sort of like myself, come to think of it!

                                Funny: I never noticed the Range Bar Counter indicator which basically does the same thing although it is not quite as visually clear being in a different panel and just a number.

                                Now you got me curious: what's that fancy-looking big lot little lot indicator you have on your chart?!
                                Last edited by cclsys; 08-14-2009, 10:22 AM.

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by lightsun47, Today, 03:51 PM
                                0 responses
                                5 views
                                0 likes
                                Last Post lightsun47  
                                Started by 00nevest, Today, 02:27 PM
                                1 response
                                8 views
                                0 likes
                                Last Post 00nevest  
                                Started by futtrader, 04-21-2024, 01:50 AM
                                4 responses
                                45 views
                                0 likes
                                Last Post futtrader  
                                Started by Option Whisperer, Today, 09:55 AM
                                1 response
                                14 views
                                0 likes
                                Last Post bltdavid  
                                Started by port119, Today, 02:43 PM
                                0 responses
                                9 views
                                0 likes
                                Last Post port119
                                by port119
                                 
                                Working...
                                X