src
Syntax
Parameters
Return Value
Example
//@version=1
init = () => {
// Show the indicator in the main panel
indicator({ onMainPanel: true, format: 'inherit' });
// Create a dropdown for the price source
// Default = 'close', grouped under "Inputs", with a short tooltip.
input.src(
"Price Source",
"close", // default
"price_source", // id (optional but recommended)
"Inputs", // group (optional)
"Choose which price feeds the plot", // tooltip
"row1" // inline group (optional)
);
};
onTick = (length, _moment, _, ta, inputs) => {
// Read the user’s selection from inputs using the returned id
const sel = inputs.price_source; // one of: 'open','high','low','close','hl2','hlc3','ohlc4'
// Plot style (kept in a single const)
const style = {
color: color.blue
// (plot.line also accepts plottype and id as extra args if needed)
};
// Build the plot using the chosen source
plot.line("Selected Source", sel(0), style.color);
};Result

Last updated