Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Current Range Bar possible High & Low Plot

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

  • cclsys
    replied
    Originally posted by NinjaTrader_Josh View Post
    cclsys,

    Please look at the Help Guide articles for them. Examples are almost always contained there.



    Print(Time[0] + " " + Close[0] + " " + double);
    Thanks for the Print Help. I was messing it up with illicit commas.

    As to the Drawing Objects, from the Help Menu (before reading your links which are the same) I added in:

    DrawLine("PossHigh", false, 1, PossHigh[0], 0, PossHigh[0], Color.Olive,DashStyle.Solid, 3);
    DrawLine("PossLow", false, 1, PossLow[0], 0, PossLow[0], Color.MediumBlue, DashStyle.Solid, 3);


    Also shorter form:
    //DrawLine("PossHigh", 1, PossHigh[0], 0, PossHigh[0], Color.Olive);

    It is working fine although I haven't tested on lots of charts so maybe the same problem will re-occur as it does with the original version.

    I have the original Plots as Transparent now though probably the whole thing should be re-written to have them just as data series and to start off defining 2 lines, but anyway:

    Problem: is there any way to emulate the Hash plot which plots above the bar, centred above it. Right now it seems I can only draw a line from the previous bar to the beginning of the current bar. It works, but it would be much nicer if I could at least get it centred and/or stretch it out wider to a little bit past the current bar.

    I attach pic so you can see the problem.
    Attached Files

    Leave a comment:


  • NinjaTrader_JoshP
    replied
    cclsys,

    Please look at the Help Guide articles for them. Examples are almost always contained there.



    Print(Time[0] + " " + Close[0] + " " + double);

    Leave a comment:


  • cclsys
    replied
    Originally posted by NinjaTrader_Josh View Post
    Unfortunately I cannot review your code to determine what is happening with it, but I assure you in normal behavior, once set, plots do not just unset.

    DrawLine() then RemoveDrawObject() when you don't want it anymore.
    You could even just use DrawLine() with a tag name and then when it is time to draw a new line, use the same tag name which would then move the old line to the new location.
    Thanks, Josh. It would be much more helpful if in yr replies you wrote out a quick code sample so I can learn what you mean.

    The Output Window is printing now. I guess when it is connected it only prints new occurrences. I didn't know that. In any case, the decimals seem to be identical so that isn't the issue.

    Printing question:

    How do I tell it to print 2 or more things on the same line with spaces in between. There are no examples in the Help Menu. For example:

    Print(Time, Close[0], my double);

    Leave a comment:


  • NinjaTrader_JoshP
    replied
    Unfortunately I cannot review your code to determine what is happening with it, but I assure you in normal behavior, once set, plots do not just unset.

    DrawLine() then RemoveDrawObject() when you don't want it anymore.
    You could even just use DrawLine() with a tag name and then when it is time to draw a new line, use the same tag name which would then move the old line to the new location.

    Leave a comment:


  • cclsys
    replied
    Originally posted by NinjaTrader_Josh View Post
    Once you set a plot it does not get unset just because a condition is no longer true. I suggest you drop the whole plot idea and just simply use DrawLine(). Draw two lines where needed and remove the line objects when not needed.
    Thanks. I have no idea how to do what you suggest, i.e. first draw it and then undraw it.

    Also, when you say: "Once you set a plot it does not get unset just because a condition is no longer true.": the funny thing is, it works fine on 90% of the charts, but doesn't only on a few for mysterious reasons. Which is why I sent in the example pictures. in the first 'good' picture, there had been plots above and below but once the bar was formed they were no longer plotted.

    I suspect another reason for this might be that if the bar closes at a high or low which often happens but the next tick is the new bar at which point there is a new Close[0] that the old bar did not have time to have the plots removed, i.e. Tick 300 makes the bar complete and Tick 301 makes a new bar, or maybe even Tick 300 was NOT a complete bar but it trades through the price and the next tick creates a new bar.

    Having written the above I threw up a 2-tick range chart and it works perfectly with only the current forming bar having the two hash marks. Then I threw up a 1-tick range chart, can't get any tighter than that: works great! So: still a mystery!

    If you could provide an example of how to plot a line that is only the width of a hash mark and also tell it to go away afterwards as a new bar forms, that would be much appreciated, since that is all I am trying to do here: plot the possible high and low of a forming Range Bar and once it is formed, have those plots disappear, either whilst the bar is still up there or when the new bar starts, either way is fine. But what I don't want is all those lines/hashes left over simply because it makes the chart look messy.
    Last edited by cclsys; 08-13-2009, 09:33 AM.

    Leave a comment:


  • cclsys
    replied
    I have also tried printing out to many decimals as in the following:

    Print( PossHigh[0].ToString("0.0000000"));
    Print( PossLow[0].ToString("0.0000000"));
    Print( Close[0].ToString("0.0000000"));

    But although it compiles, it does not print anything to the Output window. This is following the tip in the Help Menu:

    Tips
    1. You can align prices to be formatted for easier debugging such as Low[0].ToString("0.00").


    I suspect I am not understanding how to use those strings, but since nothing is explained am not sure how to proceed. Do I have to alter the main coding to have everything put into string mode? I doubt it, but in any case, don't know how to do that yet.

    Leave a comment:


  • NinjaTrader_JoshP
    replied
    Once you set a plot it does not get unset just because a condition is no longer true. I suggest you drop the whole plot idea and just simply use DrawLine(). Draw two lines where needed and remove the line objects when not needed.

    Leave a comment:


  • cclsys
    replied
    I attach a couple more little pictures showing it working properly, once when the bar is complete but the new bar is not yet up, the second with a new bar (and different range number of 6 versus 4 in the first) showing the hash plots indicating the maximum possible high and/or low of the currently -forming bar. I also show a few previous bars that have no left-over hash plots - as is the case when it is working properly.
    Attached Files

    Leave a comment:


  • NinjaTrader_JoshP
    replied
    Once you set the plot it is set. Just because a condition is no longer true does not "unset" the plot.

    Leave a comment:


  • cclsys
    replied
    I blew it up a little so you could see, but also everything got somewhat 'fat'.

    When the indicator works properly, it simply plots a hash mark above and below the currently forming Range Bar until such time as it is complete, i.e. with a 4-tick range bar the bar is incomplete with only 1,2 or 3 tick range, but as soon as the High-Low = 4 ticks, that Range Bar is 'complete' and the code says that as soon as this condition is met, 'return', i.e. don't plot anything.

    On most charts this is working exactly as desired, but for some reason on some charts, the plots remain there on previous bars making for a messy-looking chart. My picture shows many bars in the past (i.e. not the current bar on the chart, i.e. the last bar) with the hash plots at the High and Low of a bar. It doesn't happen every bar, but on many.

    So I have no idea why most of the time it works fine, but some of the time it does not.

    Leave a comment:


  • NinjaTrader_JoshP
    replied
    Not sure what I am suppose to be looking for in your picture. Please clarify.

    Leave a comment:


  • cclsys
    replied
    Originally posted by Jason11 View Post
    I get the same thing. On the ES it seems to work properly and on the TF the hash marks remain for the previous bars.

    Maybe it has something to do with the tick sizes being different?
    That should not be the problem (in theory) since the code is specifying 'TickSize' as the referent.

    I loaded several charts yesterday and none of them had the problem. But then after reading your post, I tried again and after (again many tries) one of them was bad, the TF 4 range. TF 5 range was fine (and 6,7,8,9). Often 4 gives it a problem for some reason!

    Anyway, here is a picture showing the plots. They seem to be at the right prices (and when this happened before I checked in the Data Box and indeed they were, i.e. the plot prices and the highs and lows were identical. This is why I wonder if there is not a very small decimal price difference somewhere which I can't see. Other than that, it remains a mystery.
    Attached Files

    Leave a comment:


  • Jason11
    replied
    I get the same thing. On the ES it seems to work properly and on the TF the hash marks remain for the previous bars.

    Maybe it has something to do with the tick sizes being different?

    Leave a comment:


  • cclsys
    replied
    Bernard,

    I also tried printing out the values and they seem spot on. But sometimes on some charts the plots remain on previous bars, and on other charts they don't - like they are supposed to. I wonder if there is a very small decimal difference not shown in the prints between the Bars.Period.Value * TickSize and the actual High or Low? I am still new to printing things out and haven't found out yet how to get it to print to 10 decimal pts to research this idea. But in the default printout mode, both in the Output Window and the Data Window, the value of the High or Low and the values of the plots are identical, in which case they should not be plotted.

    I know this is a small thing, but it would be nice to get it right. I will load a chart later today with the problem and post a picture.

    Leave a comment:


  • NinjaTrader_Bertrand
    replied
    cclsys, briefly checked this on ZenFire ES 09-09 Range charts and could not reproduce what you see, the Bars.Period.Value prints correctly for even and odd range charts here...

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by cmoran13, 04-16-2026, 01:02 PM
0 responses
46 views
0 likes
Last Post cmoran13  
Started by PaulMohn, 04-10-2026, 11:11 AM
0 responses
28 views
0 likes
Last Post PaulMohn  
Started by CarlTrading, 03-31-2026, 09:41 PM
1 response
163 views
1 like
Last Post NinjaTrader_ChelseaB  
Started by CarlTrading, 04-01-2026, 02:41 AM
0 responses
98 views
1 like
Last Post CarlTrading  
Started by CaptainJack, 03-31-2026, 11:44 PM
0 responses
158 views
2 likes
Last Post CaptainJack  
Working...
X