Appearance
Constants
What do you pass to size, yloc or text_halign? A constant from the namespace of the same name: size.small, yloc.abovebar, text.align_right. Each is a fixed value you can store in a variable or pick with a condition, like any other value.
pine
//@version=6
indicator("Last close, in a corner", overlay = true)
var t = table.new(position.top_right, 1, 1)
if barstate.islast
t.cell(0, 0, str.tostring(close, format.mintick), text_size = size.small, text_halign = text.align_right)
label.new(bar_index, na, "Last", yloc = yloc.abovebar, size = size.small)
bgcolor(dayofweek == dayofweek.monday ? color.new(color.blue, 92) : na) // shade each MondayThe shapes, locations and display flags of plot and plotshape are on Plots, and each drawing's own styles, such as line.style_dashed, are on its page.
xloc.*
How a drawing reads its x coordinates.
Each is a const string.
| Name | What it means |
|---|---|
xloc. | As bar indexes, the default. |
xloc. | As times in milliseconds, such as time. |
yloc.*
Where a label sits.
Each is a const string.
| Name | What it means |
|---|---|
yloc. | Above its bar's high, whatever y says. |
yloc. | Below its bar's low, whatever y says. |
yloc. | At the price y, the default. |
extend.*
Which way a line, or a box's sides, run past their two points.
Each is a const string.
| Name | What it means |
|---|---|
extend. | Both ways, to the pane's edges. |
extend. | Past its left end. |
extend. | Neither, the default. |
extend. | Past its right end. |
size.*
The size of a label, a shape or a table cell's text, from the smallest to the largest.
Each is a const string.
| Name | What it means |
|---|---|
size. | A shape grows with the space between bars, and a table's text reads as normal. |
size. | The largest. |
size. | Larger than normal. |
size. | The usual size, the default for a label's text. |
size. | Smaller than normal. |
size. | The smallest. |
text.*
How a label's, a box's or a table cell's text is aligned, wrapped and styled.
| Name | Type | What it means |
|---|---|---|
text. | const string | At the bottom of its box or cell. |
text. | const string | In the middle, across or down. |
text. | const string | At the left. |
text. | const string | At the right. |
text. | const string | At the top. |
text. | string | Bold. Add text.format_italic for both. |
text. | string | Italic. Add text.format_bold for both. |
text. | string | Plain, the default. |
text. | const string | Wrapped to fit a box's width. |
text. | const string | Never wrapped: only the line breaks you write, the default. |
font.*
The font a drawing's text is set in.
Each is a const string.
| Name | What it means |
|---|---|
font. | Trebuchet MS, TradingView's chart font. A text given no font is set in the terminal's own. |
font. | A fixed-width font, so figures line up in columns. |
position.*
Where a table sits in its pane, by row and column: top, middle or bottom, then left, center or right.
Each is a const string.
| Name |
|---|
position. |
position. |
position. |
position. |
position. |
position. |
position. |
position. |
position. |
format.*
How a number prints, in str.tostring, and as format in plot, indicator and strategy.
Each is a const string.
| Name | What it means |
|---|---|
format. | As the study's own format says, or as written where nothing does. |
format. | Rounded to the symbol's tick, syminfo.mintick. |
format. | With two decimals and a %: 12.3 prints 12.30%. The value isn't multiplied by 100. |
format. | With as many decimals as the symbol's price, from syminfo.pricescale. |
format. | Shortened with K, M, B and T, trailing zeros dropped: 1,500,000,000 prints 1.5B. |
order.*
The direction array.sort and matrix.sort sort in.
Each is a const sort_order.
| Name | What it means |
|---|---|
order. | From the smallest up, the default. |
order. | From the largest down. |
dayofweek.*
The days, as dayofweek and dayofweek() number them.
Each is a const int.
| Name | Value |
|---|---|
dayofweek. | 6 |
dayofweek. | 2 |
dayofweek. | 7 |
dayofweek. | 1 |
dayofweek. | 5 |
dayofweek. | 3 |
dayofweek. | 4 |
month.*
The months, as month and month() number them.
Each is a int.
| Name |
|---|
month. |
month. |
month. |
month. |
month. |
month. |
month. |
month. |
month. |
month. |
month. |
month. |
currency.*
Currency codes, for the currency argument of request.security and strategy, and to compare with syminfo.currency.
currency.NONE asks for no conversion. The codes from currency.BGN through currency.ZMW that TradingView doesn't list, and the coins ADA, BNB, DOGE, DOT, SOL and XRP, are extra here.
Nothing converts
No currency is converted here. request.security with another currency returns the symbol's own values and warns, and a strategy's currency changes nothing.
scale.*
No effect here
The price scale indicator and strategy take as scale.
This engine accepts scale and doesn't read it: a study's plots go on the chart's scale or on their pane's own, whatever it says.
Each is a const scale_type.