Plots
What the indicator draws for each candle: lines, columns, areas, shapes, candles, numbers, fills and backgrounds.














How to write them
Plots are listed in the plots of @indicator, in the order they stack: the first one sits at the bottom. They are all written plot.type(key, label, …).
keyis the plot’s entry in the returned dictionary, and the name its settings are saved under: unique within the indicator, insnake_case.labelis the plot’s name in the Style tab of the settings. The legend shows only the values, in the plot’s color.- The other arguments are the style: color, width, line style, type. They become the settings the user changes.
plot.series
One number per candle. nan leaves a gap.
| type | Drawing |
|---|---|
"line" | A line; it’s the default type |
"step" | A step line |
"columns" | Bars as wide as the candle, from base to the value |
"histogram" | Thin bars, from base to the value |
"area" | A line with the area fill |
"baseline" | Line and two-color fills around a level |
"circle", "cross" | A circle or a cross at the value |
plot.series("sma", "SMA", color=color("#2962FF"), width=2)
plot.series("level", "Level", type="step", pattern="dashed")
plot.series("delta", "Delta", type="columns", base=0)width is the width of the line, of the histogram bars, or the size of circles and crosses. pattern is "solid", "dashed", "dotted" or "dash_dot". Area and baseline are explained in Colors and style.
plot.shape
A shape where the returned series is True: "circle", "square", "cross", "arrow_up", "arrow_down", or "char" with the character char, even an emoji.
plot.shape("up", "Bullish cross", type="arrow_up", location="below",
color=color("up"), text="Long")
# in the function:
return {"up": ta.crossover(fast, slow)}locationis"above"or"below", above the high or below the low of the candle, or"top"or"bottom", on the edges of the pane.sizeis the size in pixels; without it, it adapts to the candle width.textis a fixed text next to each shape.
plot.ohlc
Candles or bars drawn by the indicator: the function returns (open, high, low, close). With the default colors, Up and Down, it also chooses the color of each candle.
from totaltrade.v1 import indicator, request, plot, ta
@indicator(short="HA", plots=[plot.ohlc("candles", "Heikin Ashi")])
def calculate(bars=request.bars()):
o, h, l, c = ta.heikinashi(bars.open, bars.high, bars.low, bars.close)
colors = ["up" if b >= a else "down" for a, b in zip(o, c)]
return {"candles": ((o, h, l, c), colors)}type is "candles", with wicks and hollow, or "bars", with hlc and thin.
plot.text
A row of numbers at the bottom of the pane, one below each candle, like the footprint ones. Several rows stack in the order of plots, the first at the top, and each row’s name sits on the scale, at its height. If a number doesn’t fit in its candle, all the numbers in the row are hidden. size is the text size, from 8 to 20 px.
With cell each number has a colored cell. The cell has a single color or, like color, a list of named colors. The entry becomes a tuple: the values, the cell names if there is more than one, and the intensity of each cell, from 0 to 1, which sets its opacity. If color is a list too, its names come right after the values.

plot.text("delta", "Delta", cell=[
("buy", "Buys", color("up")),
("sell", "Sells", color("down")),
])
# in the function:
sides = ["buy" if d >= 0 else "sell" for d in delta]
strength = [abs(d) / top for d in delta] # top: the largest delta you want
return {"delta": (delta, sides, strength)}- A cell with the name
None, or with intensitynanor 0, stays empty. Ananvalue leaves the cell without a number. - On a strong cell the number turns white or black, to be readable on any color.
- If the pane has only rows, they share its height and the scale shows only their names.
This is how you build a table, like Bar Statistics: only plot.text rows, in their own pane. The rows stay put even when you drag the scale, don’t count towards the drawing limit and, with scale="left", the names sit on the left. Better than drawn rectangles and texts.
plot.fill
A fill between two bounds, upper and lower: plot.series keys, numbers, or "bottom", the bottom of the pane. It has no entry in the dictionary, because it always fills between its bounds.
plot.fill("band", "Background", 70, 30, fill={"color": color("#7E57C2", 10)})
plot.fill("cloud", "Cloud", "fast", "slow", fill={"color": color("#2962FF", 15)})plot.background
Colors the full height of the pane where the returned series is True, with a transparent color to let the candles show through.
What to return
| Plot | Dictionary entry |
|---|---|
plot.series | A list of numbers |
plot.shape | A list of bools |
plot.ohlc | (open, high, low, close), four lists |
plot.text | A list of numbers; with cell, a tuple with the cells |
plot.fill | Nothing |
plot.background | A list of bools |
With named colors the entry becomes a pair: the values and the color name of each candle.
Common options
| Argument | What it does |
|---|---|
display | "all" draws it, "none" starts it hidden: in the settings it’s the Visible toggle. |
format, precision | As in @indicator, which they take their value from: for legend, labels and numbers. |
show_last_value | The last value label on the scale; on if you don’t write it. |
show_last_value_line | The last value line up to the right edge. |
editable=False | The appearance doesn’t show in the settings. |
In the Style tab

The type is also a setting: a line can become columns, area or baseline, but not an arrow, which needs True and False instead of numbers.