Skip to content

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 Monday

The 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.

NameWhat it means
xloc.bar_indexAs bar indexes, the default.
xloc.bar_timeAs times in milliseconds, such as time.

yloc.* ​

Where a label sits.

Each is a const string.

NameWhat it means
yloc.abovebarAbove its bar's high, whatever y says.
yloc.belowbarBelow its bar's low, whatever y says.
yloc.priceAt 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.

NameWhat it means
extend.bothBoth ways, to the pane's edges.
extend.leftPast its left end.
extend.noneNeither, the default.
extend.rightPast 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.

NameWhat it means
size.autoA shape grows with the space between bars, and a table's text reads as normal.
size.hugeThe largest.
size.largeLarger than normal.
size.normalThe usual size, the default for a label's text.
size.smallSmaller than normal.
size.tinyThe smallest.

text.* ​

How a label's, a box's or a table cell's text is aligned, wrapped and styled.

NameTypeWhat it means
text.align_bottomconst stringAt the bottom of its box or cell.
text.align_centerconst stringIn the middle, across or down.
text.align_leftconst stringAt the left.
text.align_rightconst stringAt the right.
text.align_topconst stringAt the top.
text.format_boldstringBold. Add text.format_italic for both.
text.format_italicstringItalic. Add text.format_bold for both.
text.format_nonestringPlain, the default.
text.wrap_autoconst stringWrapped to fit a box's width.
text.wrap_noneconst stringNever wrapped: only the line breaks you write, the default.

font.* ​

The font a drawing's text is set in.

Each is a const string.

NameWhat it means
font.family_defaultTrebuchet MS, TradingView's chart font. A text given no font is set in the terminal's own.
font.family_monospaceA 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.

format.* ​

How a number prints, in str.tostring, and as format in plot, indicator and strategy.

Each is a const string.

NameWhat it means
format.inheritAs the study's own format says, or as written where nothing does.
format.mintickRounded to the symbol's tick, syminfo.mintick.
format.percentWith two decimals and a %: 12.3 prints 12.30%. The value isn't multiplied by 100.
format.priceWith as many decimals as the symbol's price, from syminfo.pricescale.
format.volumeShortened 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.

NameWhat it means
order.ascendingFrom the smallest up, the default.
order.descendingFrom the largest down.

dayofweek.* ​

The days, as dayofweek and dayofweek() number them.

Each is a const int.

month.* ​

The months, as month and month() number them.

Each is a int.

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.

AmenoScript is compatible with Pine Script v6. Pine Script is a trademark of TradingView, Inc., which has no part in AmenoScript.