Declarations
The decorator, colors, inputs, plots and the candle and event requests.
The plot style arguments are too many for one signature: they are explained in Plots and in Colors and style.
The decorator and colors
indicator(short=None, overlay=False, plots=[], scale="auto", margins=None, name_labels=False, format="price", precision=None, max_drawings=500)
The decorator of the function that calculates: short name, pane, plots, scale and value format. You only write the arguments you need.
color(value, opacity=100)
A hex color, "#RRGGBB", or a theme color: up, down, line, buy, sell, neutral or text. Opacity goes from 0 to 100.
input
input.int(label, default, min=None, max=None, step=1, group=None, inline=None, tooltip=None, active=None)
A whole number, with min, max and the step if needed. The function receives an int.
input.float(label, default, min=None, max=None, step=None, group=None, inline=None, tooltip=None, active=None)
A decimal number, with min, max and the step if needed. The function receives a float.
input.bool(label, default, group=None, inline=None, tooltip=None, active=None)
A toggle. The function receives True or False.
input.choice(label, default, options, group=None, inline=None, tooltip=None, active=None)
A dropdown. options is a list of (value, label), with text values or None: the function receives the chosen value.
input.time(label, default, group=None, inline=None, tooltip=None, active=None)
A time of day, with hours, minutes and seconds. It’s written and received as "hh:mm:ss", like bars.calendar.time_of_day.
input.color(label, default, group=None, inline=None, tooltip=None, active=None)
A color with opacity, to pass to drawing arguments. The default is color("#RRGGBB"), without theme colors.
input.line(label, default, group=None, inline=None, tooltip=None, active=None)
The drawings’ line: color, width, line style and, if the default writes them, the line ends. The function receives the dictionary to pass to line=.
input.fill(label, default, group=None, inline=None, tooltip=None, active=None)
The drawings’ fill, with color and gradient. The function receives the dictionary to pass to fill=.
input.font(label, default, group=None, inline=None, tooltip=None, active=None)
The drawings’ font: color, size, bold and italic. The function receives the dictionary to pass to "style" in text=.
plot
plot.series(key, label, **style)
One number per candle: line, step, columns, histogram, area, baseline, circles or crosses. nan leaves a gap.
plot.shape(key, label, **style)
A shape where the series is True: circle, square, cross, arrow or a character, above or below the candle.
plot.ohlc(key, label, **style)
Candles or bars: the function returns (open, high, low, close).
plot.text(key, label, **style)
A row of numbers at the bottom of the pane, one below each candle, with the name on the scale. With cell each number has a colored cell.
plot.fill(key, label, upper, lower, **style)
A fill between two bounds: plot.series keys, numbers or "bottom", the bottom of the pane.
plot.background(key, label, **style)
Colors the full height of the pane where the series is True.
request
request.bars(timeframe=None, min_bars=0, max_bars=200000, orderflow=None, sentiment=False)
The candles of the chart symbol, or of another timeframe with timeframe: a value, an input.choice or a function that calculates it from the chart’s. min_bars and max_bars say how many to calculate; orderflow and sentiment also download that data.
request.events(kind, currencies=None, impacts=None)
Events over time of one type, today only "news": the list of economic calendar news, in time order, from the first calculated candle to the upcoming ones.
currencies are the currencies, like ["USD", "EUR"] or "All" for global news; None the symbol’s. impacts are the impacts, like ["high", "medium"]; None all.