icon
Places a chart icon from the built-in iconList at a specific bar and price. Useful for marking events, signals, or key levels with a clear visual symbol. You can pick the icon type, change its color, size, and rotation.
Syntax (one line)
icon(time, price, icon?, styles?)
Parameters
time (number) · Candle time where the icon is placed (e.g., time(0)).
price (number) · Price level where the icon sits (e.g., closeC(0)).
icon (iconList item) · The symbol to display (e.g., iconList.star, iconList.arrowUp, iconList.check).
styles (IconLineToolOverrides) · Visual options for the icon:
angle(number) · Rotation angle of the icon.color(RGBAColor | BaseColors) · Icon color.size(number) · Icon size.
Return Value
(string) · The drawing ID of the created Icon.
Example
What this does: Every 48 candles, places a green upward arrow icon at the current close. All visuals live in one const style.
//@version=1
init = () => {
indicator({ onMainPanel: true, format: 'inherit' });
};
onTick = () => {
if (index % 48 === 0) { // draw occasionally to keep charts clean
// 1) Style (IconLineToolOverrides)
const style = {
angle: 0,
color: color.green,
size: 22
};
// 2) Place the icon (from iconList) at this bar’s close
icon(time(0), closeC(0), iconList.arrowUp, style);
}
};Tips
Use
iconListentries likearrowUp,arrowDown,star,check,circleto categorize events visually.Adjust
anglewhen using directional icons to show orientation.
Warning
Don’t place large icons on every candle—it will overlap price and clutter the chart.
Good Practice
Keep a consistent color scheme (green for buy signals, red for sell, yellow for alerts).
Store commonly used styles in a
const styleobject for reuse across scripts.
Last updated