plotchar() - Pine Script Function
plotchar()
Section titled “plotchar()”Overview
Section titled “Overview”plotchar() draws a single Unicode character when a condition is true. The function is ideal for lightweight markers such as “↑”, “↓”, or letters that annotate trade setups. Characters can appear above/below bars, on the high/low, or at an exact price level with location.absolute.
Use overlay=true in your indicator() call if you want characters to appear on the price pane. Otherwise they render in the script’s separate panel.
Syntax
Section titled “Syntax”plotchar(series, title, char, location, color, offset, text, textcolor, editable, size, show_last, display, format, precision, force_overlay) → voidParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
series | series int/float/bool | Condition or value that controls visibility. Non-zero values draw the character. |
char | const string (optional) | Single-character string to plot (defaults to "•"). Supports Unicode. |
location | input location (optional) | Where to place the character (location.abovebar, location.belowbar, location.absolute, etc.). |
color | series color (optional) | Character color. Defaults to the chart theme. |
offset | simple int (optional) | Shift markers forward/backward by N bars. |
text | const string (optional) | Tooltip shown on hover. |
size | const size (optional) | Marker size (size.tiny → size.huge). |
Other arguments (title, textcolor, editable, show_last, display, format, precision, force_overlay) align with plot() defaults.
Remarks
Section titled “Remarks”- When
location.absolute, the numeric value ofseriessets the price where the character is drawn. - If
seriesevaluates tona, the marker is skipped on that bar. - Use UTF-8 dingbats (e.g.,
"✚","⚠") to create rich visual cues without importing images.
Example
Section titled “Example”//@version=5indicator("plotchar() markers", overlay=true, max_labels_count=0)
bullish = ta.crossover(ta.ema(close, 20), ta.ema(close, 50))bearish = ta.crossunder(ta.ema(close, 20), ta.ema(close, 50))
plotchar(bullish, title="Bullish flag", char="▲", location=location.belowbar, color=color.new(color.green, 0), size=size.small, text="EMA crossover")
plotchar(bearish, title="Bearish flag", char="▼", location=location.abovebar, color=color.new(color.red, 0), size=size.small, text="EMA crossunder")