Renko Price Bars Overlay

// Shows the price renko bars (or range bars) instead of the PERIOD renko
// bars that are integrated into Trading View. The normal renko bars that
// Trading View offers only consider the drawing of a new brick when the
// price closes above or below the required brick size. This can produce
// misleading charts since depending on the time interval of a chart, new
// bricks may or may not be drawn. True price renko bars will draw a new
// brick immediately upon the price exceeding the next target brick size.

// When running this script in "Traditional" mode, the painting of the
// brick overlay band is INDEPENDENT of the chart interval. If price
// exceeds the required target price for the next brick, the band is
// updated immediately, instead of waiting for the price bar on the chart
// interval to close first. The brick starting anchor point will attempt
// to be a "nice number" at a round interval for the chart ticker. For
// example, if viewing EURUSD with the box size equal to 50 ticks/pips,
// the open and close prices will take the form of 1.2100, 1.2150, 1.2200,
// 1.2250, and so on. This is the same behavior as the normal traditional
// Renko bars in Trading View and other major trading platforms such as
// Meta Trader.

// Use the tick size in traditional mode to specify the block size, in
// ticks. This may give interesting results in FOREX pairs... as the tick
// size in Trading View may be 0.00001 instead of the normal pip size of
// 0.0001, so a 10 pip block size may be '100', and not the expected '10'.
// FOREX futures should work in the manner expected, a 10 pip block size
// will indeed equal 0.0010.

// The "ATR" mode functions differently than the Trading View built in
// version. The block size is updated each time the range is exceeded.
// In Trading View, when using the ATR mode, the ATR is the last ATR
// value calculated on the ENTIRE data interval, and is applied to all
// past data. You can see this when you press the '+' sign of the ticker
// in the top left of the chart window and you will see the brick size
// as a constant, the brick size is not a function of the ever changing
// ATR value of the price action. The block size of this script is not
// updated for each price candle (i.e. each 1HR on a 1HR chart), instead
// it is updated only when the price thresholds are exceeded requiring a
// the band to be updated. At that point the current ATR is considered
// and the brick size is updated.

// Options exist to show the current high and low of the brick, and to
// show the required levels that the price must exceed to draw a new
// brick and update the band.

Please leave comments if you notice any bugs or would like any new features added. I don't find much use for plotting the H/L of the current renko candle, but I have seen some request it in the past.

Release Notes: Fixed bug with band not painting correctly under certain conditions.
Release Notes: Fixed problem where price moves rapidly through multiple brick levels and the band does not update accordingly.
Release Notes: Fixed problem with open note printing correctly when there is a rapid reversal that moves through multiple block levels in one candle. ATR mode now rounds the target brick thresholds to the nearest tick.
Release Notes: Update 1

Added a check box to decide whether or not to use the PERIOD based close price to update the band.

Update 2

Added the ability to use a separate time interval other than the chart interval for the band update. See the new comments in the body of the script to understand how to use. Using an interval other than the chart interval will only have an effect on ATR mode, or when brick creation is decided based on closing prices, rather than highs/lows.
Release Notes: Added logic to detect if tick size is < 0.0001. You should be able to input the tick size directly now without having to worry about anything for any FX pair, including futures.
Release Notes: Fixed tick issues for futures that are already at mintick = 0.0001.
Release Notes: Added projections. Fixed various timing bugs with real time. Added brick rounding option so ATR bricks are always multiples of the rounding tick size.
Release Notes: Added 3 instructional videos:

Release Notes: Added 4 different color themes.

Added bar coloring and ability to hide the band. Use this when it is desired to reduce clutter and just see the brick direction changes. It is based to have the chart in "Hollow Candle" setting to see this.

Improved tick block sizing for other symbols.
Release Notes: Fixed bug for projection band, the colors were wrong.
Release Notes: Added Moving Averages (Exponential and Simple options) to the band close and open price. There is also an optional fill between these plots.

Release Notes: Fixed incremental moving average calculations. I am excited to announce that Bollinger Bands have been added!
Release Notes:
  • Fixed bugs with fast moving prices and renko band not painting properly.
  • Updated algorithm to decide when the moving average trend is pending or flips to positive/negative.
  • Updated tick/pip sizing.
Release Notes:
  • Updated themes, added dark option for lighter screen backgrounds.
Release Notes:
  • Now show MA Trend level flip price. This is the threshold the price much breach in order to flip the moving average trend.
  • Fixed more bugs when volatility is high.
Release Notes:
  • I am pleased to add ATR Chandelier Stop. This is identical to this ATR Stop Script. This will function according to the renko bars including wick calculations.
  • Similar to the Moving Average flip label, the ATR stop will also have a flip label that indicates the price which must be reached in order to flip the ATR Stop.
  • Added alerts.
  • Changed threshold breach calculation for new bricks to be >= or <= to the next target brick price to generate a new brick. Previously these levels had to be broken by 1 tick.
Release Notes:
  • Added wicks. Alerts are provided for Hammer Bars (up and down). I recommend doing the "Notify Once Per Bar" so that you are instantly notified instead of waiting for a close of the current time candle.
  • Keltner Channels added. You can now flip between Bollinger and Keltner channels depending on what you like. There are new settings introduced for the Keltner ATR Length and the Multiplier.
  • BIG NOTE: I have removed the multi-timeframe aspect of this indicator. The performance cost was huge because of all of the security calls, and for some reason pine conditional statements will go through ALL of the conditions and invoke the security function regardless. This is a big problem in the pine language: if...else... functions or conditionals (weGood ? shakeHands() : hugItOut()) should only execute the passed statement, not both. You will notice a drastic performance increase in the loading time and CPU drain.
Release Notes:
  • Fixed problem with ATR projected stop.
  • Added alerts for Renko Trend Change when the current bricks change from red to green or vice versa (Renko Trend Change Up/Down).
Release Notes:
  • Fixed Renko volatility algo.
Release Notes: Deleted. Code has been moved to a protected script found here

Remove from Favorite Scripts Add to Favorite Scripts


Wow, phenomenal work!
+1 Reply
Hello there, this is a good tool to understand the market.
The sad thing is that it repaints. If you put "security" in the code there are simply no chances for traders!
Looking at the chart in the past it looks to good to be true, as in fact the indicator is adjusting at 10/15 min intervals....

Any chance to have a new series of indicators with no "security"?

+1 Reply
mortdiggiddy davide.antonio.formenton
@davide.antonio.formenton, This code doesn't repaint, because it blends historical data from 1 period ago (locked in) with live data (no security function used). If you look at the source code you will see this.

This is the time and tested way of using the security function safely.

Again, no repainting, I would not even bother to write this if that were the case.
mortdiggiddy mortdiggiddy
@davide.antonio.formenton, One more note, the security function is strategically used in a way that moves the ribbon backward "a certain offset" and then shows constantly updated live ribbon as the "projection". The offset is determined by the desired interval, not the chart interval.

I suggest watching the 3 instructional videos to understand more.
@mortdiggiddy, Hi mate, thanks for your answer. I did look into your videos but after following the indicator on different CFD I decided to mark the "looked in" sign of the Renko with an arrow. After a while the mark of the indicator moved away from my arrow. (I was looking at a behavior similar to 1 u showed in the 3rd video).
I got really confused because it was a very good indy to use with oscillators and I decided to write.
I thought I played too much with the multiplier and let the indy rethink what it was doing.

What settings do u suggest for a 1 min chart on CFDs?
mortdiggiddy davide.antonio.formenton
@davide.antonio.formenton, Hmmm I'm not sure I understand your first paragraph.

CFDs are things like SPX500, NAS100, US30, etc.

You will have to play around with it I prefer ATR mode in 5 pip intervals (5 pip/tick ATR Rounding) for anything 5 minute - 60 minute.
@mortdiggiddy, Let me give a good look and come back to you. As I said it was my very favorite indy. Hope to adjust it to my needs and use it as much as possible also on currencies and stocks.

Hello, sorry to ask such a simple question but besides adding your indicator to my chart is there anything special I need to do to get it working. I activate your indicator, even play with all the settings but nothing happens. Please if you can assist as your indicator seems to be the solution to TV default renko charts.
mortdiggiddy SIMPROVSA
@SIMPROVSA, Please see the last release notes update for this script and you will be forwarded to the right location.
Home Stock Screener Forex Screener Crypto Screener Economic Calendar How It Works Chart Features Pricing Refer a friend House Rules Help Center Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Blog & News Twitter
Profile Profile Settings Account and Billing Referred friends Coins My Support Tickets Help Center Ideas Published Followers Following Private Messages Chat Sign Out