Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Couple Renko issues.

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

    Couple Renko issues.

    1. Plotting(calculating) issue - see attached jpeg.

    2. Volume issue - volume increases and decreases during the same bar - see attached short video in zip file
    Attached Files

    #2
    roonius,

    Are you on NT7B5?
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Josh View Post
      roonius,

      Are you on NT7B5?
      Yes I am on nt7b5 - sorry for not clarifying that in the first post

      Comment


        #4
        Odd. Have you tried removing your old data and loading in fresh data? Did you do a clean install? I am currently unable to reproduce on my end.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Josh View Post
          Odd. Have you tried removing your old data and loading in fresh data? Did you do a clean install? I am currently unable to reproduce on my end.
          Yes I did clean install

          Hard to say what causes it, since it occurs in unpredictable places;
          I just loaded new chart with es 2 tick brick size and it only occured once within last 3 days

          Comment


            #6
            Originally posted by NinjaTrader_Josh View Post
            Odd. Have you tried removing your old data and loading in fresh data? Did you do a clean install? I am currently unable to reproduce on my end.
            Josh I quickly examinated your RenkoBarsType code.
            I believe the problem is when price jumps-gaps by more than box size,
            if you open the chart with thinly traded instrument you will see quite few of those occurences. (make sure you have "small" brick size)

            I am not 100 % sure but I think you should recheck code portion where 1 price tick might create more than 1 brick.

            Comment


              #7
              roonius,

              I was unable to reproduce with the settings I saw in your screenshot. Please provide exact instrument, exact settings, and data provider used to reproduce. Thank you.
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_Josh View Post
                roonius,

                I was unable to reproduce with the settings I saw in your screenshot. Please provide exact instrument, exact settings, and data provider used to reproduce. Thank you.
                Any instrument : ES, YM, TF, NQ. Box size 2 - 4.
                Zen-Fire

                Comment


                  #9
                  roonius,

                  Thanks. Got it this time.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    I have been looking at this today, and I think there are numerous issues with the RenkoBarsType code. After trying to fix it, I gave up and rewrote it to make sense. The code below seems to work with some caveats discussed below. Just replace the top portion of the RenkoBarsType class in @BarsTypes.cs with the code below and compile something and restart to try it.

                    First caveat, this is unsupported code, so there may be better ways to do some things. Hopefully, the NT Dev guys can use this as a base.

                    Second caveat, I think there may be a BUG in UpdateBar(), as I can not seem to get the bar open value to change. This is important in two cases. First, when a bar reverses you need to change the open. Second, I was trying to set the open value == close value while the lastBar is updating, so just a dash would display until the bar completes. The interesting thing is that the bars get displayed correctly, but if you pull up the data window, you can see that the open values are not right.

                    The code below also maintains the wick values in the high/low bar values. To display these, you can enable CandleStick ChartStyleTypes. When you do this, the wrong close I mentioned above gets displayed (thats how I stumbled onto it).

                    I would be happy to walk thru / explain this to NT Dev if they just PM me.

                    Code:
                    	public class RenkoBarsType : BarsType
                    	{
                    		private static bool	registered	= Data.BarsType.Register(new RenkoBarsType());
                    		private double		offset;
                    		private double		renkoHigh;
                    		private double		renkoLow;
                    
                    		/// <summary>
                    		/// </summary>
                    		/// <param name="bars"></param>
                    		/// <param name="open"></param>
                    		/// <param name="high"></param>
                    		/// <param name="low"></param>
                    		/// <param name="close"></param>
                    		/// <param name="time"></param>
                    		/// <param name="volume"></param>
                    		/// <param name="isRealtime"></param>
                    		public override void Add(Data.Bars bars, double open, double high, double low, double close, DateTime time, long volume, bool isRealtime)
                    		{
                    			if (bars.Count == 0 || bars.IsNewSession(time)) {
                    				int    BoxSize  = bars.Period.Value;
                    				double TickSize = bars.Instrument.MasterInstrument.TickSize;
                    				offset = BoxSize * TickSize;
                    
                    				renkoHigh = close + offset;
                    				renkoLow  = close - offset;
                    
                    				AddBar(bars, close , close , close , close , time, volume, isRealtime);
                    				bars.LastPrice = close;
                    			}
                    			else {
                    				Data.Bar bar = (Bar) bars.Get(bars.Count-1); 
                    
                    				if (close >= renkoHigh) {
                    					long barVolume = close == renkoHigh ? volume : 0;
                    					UpdateBar(bars, renkoHigh-offset, renkoHigh, bar.Low, renkoHigh, time, barVolume, isRealtime);
                    					renkoLow  = renkoHigh - 2.0 * offset;
                    					renkoHigh = renkoHigh + offset;
                    
                    					while (close >= renkoHigh) {  // add empty bars to fill gap
                    						barVolume = close == renkoHigh ? volume : 0;
                    						AddBar(bars, renkoHigh-offset, renkoHigh, renkoHigh-offset, renkoHigh, time, barVolume, isRealtime);
                    						renkoLow  = renkoHigh - 2.0 * offset;
                    						renkoHigh = renkoHigh + offset;
                    					}
                    
                    					// add final partial bar
                    					AddBar(bars, renkoHigh-offset, close, renkoHigh-offset, close, time, barVolume == 0 ? volume : 0, isRealtime);
                    				}
                    				else if (close <= renkoLow) {
                    					long barVolume = close == renkoLow ? volume : 0;
                    					UpdateBar(bars, renkoLow+offset, bar.High, renkoLow, renkoLow, time, barVolume, isRealtime);
                    					renkoHigh = renkoLow + 2.0 * offset;
                    					renkoLow  = renkoLow - offset;
                    
                    					while (close <= renkoLow) {  // add empty bars to fill gap
                    						barVolume = close == renkoLow ? volume : 0;
                    						AddBar(bars, renkoLow+offset, renkoLow+offset, renkoLow, renkoLow, time, barVolume, isRealtime);
                    						renkoHigh = renkoLow + 2.0 * offset;
                    						renkoLow  = renkoLow - offset;
                    					}
                    
                    					// add final partial bar
                    					AddBar(bars, renkoLow+offset, renkoLow+offset, close, close, time, barVolume == 0 ? volume : 0, isRealtime);
                    				}
                    				else {
                    					UpdateBar(bars, close, (close > bar.High ? close : bar.High), (close < bar.Low ? close : bar.Low), close, time, volume, isRealtime);
                    				}
                    				bars.LastPrice = close;
                    			}
                    		}

                    Comment


                      #11
                      Ok, the reason the bars display correctly without the correct open is because NT works around this in the OpenClose Chart Style, by building in knowledge of the brick size in the chart style and recalculating the open if needed.

                      Seems like this belongs in the bar formation logic, not the display code.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                      0 responses
                      637 views
                      0 likes
                      Last Post Geovanny Suaza  
                      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                      0 responses
                      366 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by Mindset, 02-09-2026, 11:44 AM
                      0 responses
                      107 views
                      0 likes
                      Last Post Mindset
                      by Mindset
                       
                      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                      0 responses
                      569 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by RFrosty, 01-28-2026, 06:49 PM
                      0 responses
                      571 views
                      1 like
                      Last Post RFrosty
                      by RFrosty
                       
                      Working...
                      X