Non-standard chart types data
These functions allow scripts to fetch information from non-standard
bars or chart types, regardless of the type of chart the script is
running on. They are heikinashi
, renko
, linebreak
, kagi
and
pointfigure
. All of them work in the same manner; they create a
special ticker identifier to be used as the first argument in a
security
function call.
heikinashi function
Heikin-Ashi means average bar in Japanese. The open, high, low and close prices of Heikin-Ashi candlesticks are synthetic; they are not actual prices. Each value is calculated using combinations of normal OHLC values from the current and previous bar. The calculations used make Heikin-Ashi bars less noisy than normal candlesticks.
The
heikinashi()
function creates a special ticker identifier for requesting Heikin-Ashi
data with the security
function.
This script requests low prices of Heikin-Ashi bars and plots them on top of the usual candlesticks:
Note that the low prices of Heikin-Ashi bars are different from the low prices of the normal candlesticks.
If you wanted to switch off extended hours data in Example 5, you
would need to use the tickerid
function first, instead of using the
syminfo.tickerid
variable directly:
Note that we use an additional fourth parameter with security
:
gaps=barmerge.gaps_on
, which instructs the function not to use
previous values to fill slots where data is absent. This means we will
get empty areas during extended hours. To be able to see this on the
chart, we also need to use a special plot style
(style=plot.style_linebr
), the Line With Breaks style.
You may plot Heikin-Ashi bars from a script so they look exactly like a chart’s Heikin-Ashi bars:
You will find more information on the plotcandle() and plotbar() functions in the Custom OHLC bars and candles section.
Renko function
Renko bars only plot price movements, without taking time or volume into consideration. They are constructed from ticks and look like bricks stacked in adjacent columns1. A new brick is drawn after the price passes the top or bottom by a predetermined amount.
Please note that you cannot plot Renko bricks from Pine script exactly as they look. You can only get a series of numbers similar to OHLC values for Renko bars and use them in your algorithms.
For detailed information, see renko().
Linebreak function
The Line Break chart type displays a series of vertical boxes that are based on price changes[^2].
Please note that you cannot plot Line Break boxes from Pine script exactly as they look. You can only get a series of numbers similar to OHLC values for Line Break charts and use them in your algorithms.
For detailed information, see linebreak().
Kagi function
Kagi charts are made of a continuous line that changes directions. The direction changes when the price changes[^3] beyond a predetermined amount.
Please note that you cannot plot Kagi lines from Pine script exactly as they look. You can only get a series of numbers similar to OHLC values for Kagi charts and use them in your algorithms.
For detailed information, see kagi().
Pointfigure function
Point and Figure (PnF) charts only plot price movements[^4], without taking time into consideration. A column of X’s is plotted as the price rises, and O’s are plotted when price drops.
Please note that you cannot plot PnF X’s and O’s from Pine script exactly as they look. You can only get a series of numbers that are similar to OHLC values for PnF charts and use them in your algorithms. Every column of X’s or O’s is represented with four numbers. You may think of them as synthetic OHLC PnF values.
For detailed information, see pointfigure().
Footnotes
-
On TradingView, Renko, Line Break, Kagi and PnF chart types are generated from OHLC values from a lower timeframe. These chart types thus represent only an approximation of what they would be like if they were generated from tick data. ↩