Plotting & style
Draw with the plot family. Call these unconditionally, in the same order every time (same rule as Pine).
// Each line is one call; mix them as you need. Titles name the Style-tab rows.
const ma = ta.sma(close, 20);
plot(ma, { title: 'MA', color: '#2962ff', width: 2, plotStyle: 'stepline' });
// plotStyle: line · linebr · stepline · histogram · columns · area · areabr · circles · cross
plot(ma, { title: 'MA +5', offset: 5, trackPrice: true }); // shift 5 bars right; dotted level at the latest value
plotHist(close.sub(ma), { title: 'Distance', color: '#787b86', baseValue: 0 }); // histogram bars
plotShape(ta.crossover(close, ma), { title: 'Cross up', shape: 'triangleup', color: '#089981',
size: 'small', location: 'below', text: 'Buy' });
// location: above · below · absolute (with price: a Series)
plotChar(ta.crossunder(close, ma), { title: 'Cross down', char: '😊', size: 'large' }); // text only: an emoji, a letter, a word
plotCandle(open, high, low, close, { title: 'Candles', upColor: '#089981', downColor: '#f23645' }); // custom candles
hline(100, { title: 'Level 100', color: '#787b86', style: 'dashed' }); // static level
bgColor(close.gt(ma), { title: 'Above MA', color: 'rgba(8,153,129,0.08)' }); // tint the background
// Per-bar colour, Pine's color = rising ? green : red
plot(ma, { title: 'MA trend', colors: [{ when: ma.gt(ma.offset(1)), color: '#089981' },
{ when: ma.lt(ma.offset(1)), color: '#f23645' }] });Style tab & colours
The indicator dialog has two tabs, like TradingView: Inputs (your input.* calls, grouped) and Style: one row per plot layer with show/hide, colour, width, plot style and marker size, generated for you. Colour helpers: alpha(colour, opacity) and mix(a, b, t).
// Every plot layer gets a row in the dialog's STYLE tab automatically:
// show/hide, colour, width, plot style, marker size. Keyed by its title.
// So: title every plot, and don't add your own "Show X" toggles for plots.
plot(ta.ema(close, 20), { title: 'EMA 20', color: '#2962ff' });
// Objects (label / line / box / table) have no Style row: give them colour inputs.
const bull = input.color('Bullish', '#089981', { group: 'Colours', inline: 'c' });
const bear = input.color('Bearish', '#f23645', { group: 'Colours', inline: 'c' });
const up = close.value >= open.value;
box({ left: 20, right: 0, top: ta.highest(high, 20).value, bottom: ta.lowest(low, 20).value,
fillColor: alpha(up ? bull : bear, 0.16), // same colour at 16% opacity
borderColor: up ? bull : bear });