Marks bars with a single character, drawn where a condition is true or at an absolute price.
plotchar works like plotshape but draws one Unicode character instead of a preset shape. Pick a character such as "x", "▲" or "●". Only the first character of char is used.
The character, location, size and title are read on the first bar; the color and text color can change per bar. Optional text prints beside the character.
Syntax
plotchar(series: series int/float/bool, title: const string (optional), char: input string (optional), location: input string (optional), color: series color (optional), offset: simple int (optional), text: const string (optional), textcolor: series color (optional), editable: input bool (optional), size: const string (optional), show_last: input int (optional), display: input plot_display (optional), format: input string (optional), precision: input int (optional), force_overlay: const bool (optional)) -> voidArguments
| Name | Type | Default | Description |
|---|---|---|---|
| series | series int/ | required | A bool or number. Where it is true or non-zero the character is drawn. With location.absolute it is the price level. |
| title | const string | "Char" | Name shown in the legend and Data Window. |
| char | input string | "★" | The character to draw. Only its first character is used. |
| location | input string | location. | Placement, a location.* constant: abovebar, belowbar, top, bottom or absolute. |
| color | series color | #2962FF | Character color, evaluated per bar. |
| offset | simple int | 0 | Shifts the characters by this many bars; negative moves them into the past. |
| text | const string | "" | Text drawn with each character. |
| textcolor | series color | na | Color of the text, evaluated per bar. |
| editable | input bool | true | Accepted for compatibility and ignored. |
| size | const string | size. | Size, a size.* constant: auto, tiny, small, normal, large or huge. |
| show_last | input int | na | Accepted for compatibility and ignored. |
| display | input plot_display | display. | Where the characters are shown. display.none hides them from the chart. |
| format | input string | format. | Accepted for compatibility and ignored. |
| precision | input int | na | Accepted for compatibility and ignored. |
| force_overlay | const bool | false | When true, draws on the main chart pane even if the script runs in its own pane. |
Returns
Nothing.
Remarks
- plotchar can also show a value in the Data Window without drawing on the chart: use
location.topwith display =display.data_window.
Example
//@version=6
indicator("Inside bars", overlay = true)
inside = high < high[1] and low > low[1]
plotchar(inside, "Inside bar", "•", location.abovebar, color.orange, size = size.small)See also
Runs on Sidechair