Indicator · Pine Script v4 · Own pane

Renko Acceleration

by f-cksociety

Calculates the time elapsed between consecutive bars to measure market speed and volatility, designed primarily for Renko chart blocks where bar duration varies.

View on GitHub

GitHub stars11on the repository
Pine versionv4older, still runs
Lines of code62
Settings3inputs
LicenceMPL-2.0
Last update4 years ago20 Sep 2022

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

62 lines of Pine Script v4 from renko-acc.pine, published under MPL-2.0. Keep the author's credit and licence lines when you reuse it.

renko-acc.pine
//@version=4
// Renko Acceleration
//
//   Renko is a very useful charting method for analyzing stock movement.  
//   It does a great job of filtering out all the excess noise so that all we're
//   left with is pure price action. But, what about time? Time is a fundamental
//   part of chart analysis and without it we're only seeing part of the 
//   picture. After all, shouldn't we take a very different approach to trading
//   signals from a block that renders in 2 seconds as opposed to a block that
//   renders in 30 minutes?
//
//   This indicator provides the best of both worlds, enabling us to correlate 
//   the passing of time with price movement and see clearly when squeezes and
//   breakouts occur. 
//
//   As the indicator turns up to green we can see that volatility is on the 
//   move and the market is accelerating (breakout), and as it turns down to red 
//   the market is stagnating (squeeze). There is also an alternate 'Precise' 
//   view which renders the exact time per block for more granular analysis.
//
study("Renko Acceleration", overlay=false)

// Allow selection of signal content.
IncludeFilter = input(true, 'Include Filter')

mode = input("Momentum", "Display Mode", options=["Momentum", "Precise"])
smoothing = input(10, "Smoothing", input.integer, minval=0)

float duration = (time-time[1]) / (1000*60) // block time in seconds
float accel = na
color accelColor = na
         
if mode == "Momentum"
    bline = sma(duration, 100) * 1.25
    accel := max(bline-duration, -20) // trim negative outliers
    accel := smoothing ? sma(accel, smoothing) : accel
    accelColor := accel > 15 ? color.lime : 
         accel > 5 ? color.green : 
         accel > 0 ? color.olive : 
         accel > -5 ? color.yellow : 
         accel > -10 ? color.orange : color.red

if mode == "Precise"
    accel := duration
    accelColor := duration > 30 ? color.red : 
         duration > 15 ? color.orange : 
         duration > 5 ? color.yellow : color.silver
     
plot(accel, "Time", style=plot.style_histogram, color=accelColor)

// ————— Filter.
FilterLong = accel > 0
FilterShort = accel > 0

// ————— Build required values corresponding to states.
Filter = FilterLong ? 0.001 : FilterShort ? 0.001 : 0

// ————— We must decide which value will be sent in case more than one is different than 0, since only one value can be sent at each bar.
// Priority is given to exits, with filter states coming last.
Signal = IncludeFilter and Filter != -0.001 ? Filter : na
// ————— Plot signal which is to be connected to the Engine through the External Indicator field at the very bottom of the Engine's Settings/Inputs.
plot(Signal, 'Signal')

Overview

In Momentum mode, it contrasts the current duration against a 100-period moving average baseline, applies optional smoothing, and plots a color-coded acceleration histogram. In Precise mode, it plots the raw block duration. It also exports an external filter state for integration with the PineCoders Backtesting Trading Engine. Draws in a separate pane.

Details

Published by

f-cksociety on GitHub

Type

Indicator, Pine Script v4

Draws

Separate pane below the chart

Category

Volatility & bands, Oscillators & momentum, Breakout

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Include FilterbooltrueIncludeFilter
Display ModestringMomentummode
Smoothingint10smoothing
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

Chop and Explode

by capissimo
114 stars

This indicator measures market consolidation and breakout phases by computing a scaled Relative Strength Index (RSI) on normalized price data. It identifies chop zones when the RSI oscillates between 40 and 60, highlighting tight consolidation between 45 and 5

Indicator v5 Oscillators & momentumVolatility & bands
Updated 1 year ago · None stated GitHub repository of Chop and Explode

Squeeze Momentum

by mihakralj
99 stars

This indicator plots Squeeze Momentum in a separate pane. It compares Bollinger Bands with a Keltner Channel to mark a squeeze when the bands sit inside the channel. Momentum is a linear regression of price relative to a Donchian midline and an SMA, shown as a

Indicator v6 Volatility & bandsOscillators & momentum
Updated 4 weeks ago · Apache-2.0 GitHub repository of Squeeze Momentum

MACD Breakout

by jerryinyang
5 stars

This indicator plots a higher-timeframe MACD breakout setup on the price chart and combines it with linear regression channels. It marks support and resistance zones from MACD histogram sensitivity, then filters them with the MACD zero line, a linear regressio

Indicator v4 Oscillators & momentumBreakout
Updated 2 years ago · None stated GitHub repository of MACD Breakout

Squeeze Panel

by amico1234
1 stars

Squeeze Panel plots a volatility squeeze in a separate pane. It marks a squeeze when Bollinger Bands sit inside a Keltner Channel and marks when the bands expand outside it. The user chooses Money Flow Index or linear regression to color likely breakout direct

Indicator v4 Volatility & bandsOscillators & momentum
Updated 2 years ago · None stated GitHub repository of Squeeze Panel

Raschke Patterns

by TradersPost
218 stars

This overlay indicator marks Linda Raschke short-term bar setups on the price chart. It flags Turtle Soup and Turtle Soup plus one false breakouts of a prior extreme, 80-20 bars, inside bars, failed inside-bar breakouts, outside up and down bars, NR4 and NR7 c

Indicator v6 Candlestick patternsBreakout Repaints
Updated 3 months ago · None stated GitHub repository of Raschke Patterns

GainzAlgo V2 Alpha

by Bakomebandias
8 stars

This overlay indicator scores breakouts of recent highs and lows against failed-breakout checks, EMA trend alignment, RSI momentum, and an ATR volatility band. It plots green buy and red sell labels when conditions pass a minimum score, and it prints ATR-based

Indicator v6 TrendOscillators & momentum
Updated 6 months ago · None stated GitHub repository of GainzAlgo V2 Alpha

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers