Inputs
Make it configurable with input.*. Each returns the current value, so use it inline. Settings appear in the indicator dialog.
export default indicator('EMA Cross', { placement: 'overlay' }, () => {
// input.* shows up as a setting in the indicator dialog, and returns the
// current value: use it directly.
// group / inline / tooltip lay the dialog out like TradingView: a titled
// section, two fields on one row, an (i) with help text.
const fastLen = input.int('Fast', 9, { min: 1, max: 200, group: 'Moving Averages', inline: 'len' });
const slowLen = input.int('Slow', 21, { min: 1, max: 400, group: 'Moving Averages', inline: 'len' });
const src = input.source('Source', 'close', { group: 'Moving Averages', tooltip: 'Price the EMAs are built on' });
plot(ta.ema(src, fastLen), { title: 'Fast EMA', color: '#2962ff', width: 2 });
plot(ta.ema(src, slowLen), { title: 'Slow EMA', color: '#f23645', width: 2 });
});Input types
Also available: input.float, input.bool, input.string (a dropdown: pass { options: [...] }), input.color, input.source (returns a Series), input.timeframe, input.session (“0930-1600”), input.time (a date-time anchor) and input.text. Every input takes group, inline and tooltip.