Start with the numeric series and global scope
The series argument supplies the y-value on each bar. It can be a price, a moving average, a calculated oscillator or a constant. plot() returns a plot ID, which can be stored for fill(); that ID is different from the numeric series. A title is a compile-time string used to identify the output in settings and readouts.
- A plot call belongs outside if blocks, loops and function bodies. Calculate a conditional value first, then pass it to a global plot call.
- For conditional output, select the number when enabled and na otherwise. Replacing missing values with zero creates real zero observations and can stretch the scale.
- A series boolean is not a numeric plot argument. An explicit condition ? 1 : 0 conversion makes the intended numeric representation clear.
- On an open market bar, a series based on close can change with updates. Choosing a different plot style does not confirm the underlying calculation.