Lipi Reference Lipi

Types

plot

It's used to draw a line or series of values on the chart. It is the most commonly used function for visualizing indicators like moving averages, RSI, and custom calculations.

Example


          indicator("Multi Plot Example", overlay=false)
// Generate a sample sine wave
length = 50
sineWave = math.sin(bar_index * 2 * 3.1415 / length) * 50
// Plot the sine wave as a solid line
plot(sineWave, title="Sine Wave", color=color.blue, linewidth=2, style=plotStyle.line)
// Plot the absolute sine wave as a histogram
plot(math.abs(sineWave), title="Absolute Sine Wave", color=color.green, style=plotStyle.histogram)
// Plot a cross marker at every bar based on sine wave peaks
plot(sineWave > 40 ? sineWave : na, title="Peaks", color=color.orange, style=plotStyle.cross)
// Plot circles at troughs of the sine wave
plot(sineWave < -40 ? sineWave : na, title="Troughs", color=color.purple, style=plotStyle.scatter)