Drawing
4 entries. What each one takes, what it returns, and a working example.
box(bar1, price1, bar2, price2, color?, text?)
Does not return a value; adds a rectangular region with the given corners.
The price arguments may be series. For highlighting a supply/demand zone, a consolidation range or an event window.
box(0, highest(high, 50), 50, lowest(low, 50), "#2962ff", "bolge") plot(close)
Frames the high-low range of the first 50 bars with a box labelled "bolge".
Does not return a value; adds a text panel in the top-right corner with the rows.
Each argument becomes a row. Build rows with text to embed live values; usually called once on the last bar.
if barstate.islast { infoTable(text("Kapanis: {0}", close), text("RSI: {0}", rsi(close, 14))) } plot(close)
On the last bar shows close and RSI values in a two-row panel.
label(price, text, bar?, color?, style?, size?)
Returns nothing; it draws a text label box onto the chart.
Usually called inside a conditional block: if condition { label(...) }. This way the bar index becomes a scalar and dynamic text (str.tostring) can be used. Use in text to split the label across multiple lines, which also shifts it to avoid overlapping another marker.
Call the label inside a conditional block (if cond { ... }) so the bar index resolves to a single value and the text can show the current reading.
if crossover(close, sma(close,10)) { label(low, "AL", barIndex, color="#26a69a", style="labelup") }
A green 'BUY' label at the low level on every cross-above bar.
if barstate.islast { label(close, "Son: " + str.tostring(close), last_bar_index) }
A dynamic label showing the closing price on the last bar.
trendline(bar1, price1, bar2, price2, color?, style?)
Does not return a value; adds a straight line between the two points.
The price arguments may be series; then the value at the relevant bar is used. For placing trend, support/resistance or channel lines by hand.
trendline(0, low, 50, high) plot(close)
Draws a line from the first bar's low to bar 50's high.
trendline(0, lowest(low, 50), 50, highest(high, 50), "#26a69a", "dashed") plot(close)
Connects the low and high of the first 50 bars with a green dashed line.