Home » Ticker Functions » Using the ticker.renko Function in Pine Script

Using the ticker.renko Function in Pine Script

Photo of author
Published on

One of the powerful features it offers is the ability to visualize and work with Renko charts using the ticker.renko function. This tutorial will dive deep into the nuances of the ticker.renko function, walking you through its syntax, arguments, and practical use cases.

Understanding Renko Charts

Before we delve into the function itself, it’s crucial to grasp what Renko charts are. Unlike traditional charts which plot price against time, Renko charts focus solely on price movement, ignoring time and volume. This unique perspective makes Renko charts particularly valuable in identifying key support and resistance levels.

ticker.renko Syntax & Arguments

Syntax:

ticker.renko(symbol, style, param, request_wicks, source) → simple string

Arguments:

  1. symbol (simple string): The ticker identifier of the symbol.
  2. style (simple string): This determines how the size of the Renko boxes is set. It can either be ‘ATR’ (Average True Range) or ‘Traditional’.
  3. param (simple int/float): Specifies the ATR Length if style is ‘ATR’, or defines the Box Size if style is ‘Traditional’.
  4. request_wicks (simple bool): If set to true, wick values are returned for Renko bricks, providing more detailed price information. Conversely, if set to false, the high and low values will always equate to either the opening or closing value. The default value is false.
  5. source (simple string): This defines the source used to calculate bricks. It can be either “Close” or “OHLC”, with the default being “Close”.

Unique Use Case: Visualizing Renko Candles

To demonstrate the power and versatility of the ticker.renko function, let’s look at a unique use case:

//@version=5
indicator("Renko candles", overlay=false)
renko_tickerid = ticker.renko(syminfo.tickerid, "ATR", 10)
[renko_open, renko_high, renko_low, renko_close] = request.security(renko_tickerid, timeframe.period, [open, high, low, close])
plotcandle(renko_open, renko_high, renko_low, renko_close, color = renko_close > renko_open ? color.green : color.red)
ticker.renko Function in Pine Script

Code Breakdown:

  1. indicator("Renko candles", overlay=false): This initializes a new custom indicator titled “Renko candles”. The overlay property is set to false so that the indicator appears in a separate pane below the main chart.
  2. renko_tickerid = ticker.renko(syminfo.tickerid, "ATR", 10): Here, we’re setting the Renko box size using the Average True Range (ATR) of the last 10 bars.
  3. [renko_open, renko_high, renko_low, renko_close]: This line is responsible for retrieving the Renko bar’s OHLC values.
  4. plotcandle(...): We’re plotting the Renko candle using the previously retrieved values. If the closing value is greater than the opening value, the candle is colored green (indicating a rise), otherwise, it’s colored red (indicating a decline).

Key Takeaway

The ticker.renko function in Pine Script enables traders and developers to efficiently tap into the power of Renko charts. Whether you’re looking to visualize price movements more clearly or want to build a unique Renko-based strategy, understanding this function is pivotal.

Conclusion

Pine Script continues to be a powerful tool for those looking to customize their TradingView experience. The ticker.renko function serves as an excellent example of how Pine Script can cater to specialized charting needs, enhancing one’s technical analysis arsenal. With a good grasp of this function, the possibilities are limitless!

Leave a Comment