Technical Articles

Pine Script Part 3: Indicator Creation, plot(), and Visual Analysis

Nov 29, 202518
#Pine Script#indicator#plot#technical analysis#TradingView

Pine Script Part 3: Indicator Creation and plot() Mastery

In this chapter we dive into the core visual tools of Pine Script that allow you to create beautiful, functional, and professional indicators. The power of Pine Script is not just calculation—it's expressing analysis visually.

Topics covered:

  • Creating indicators
  • plot(), plotshape(), plotchar(), barcolor(), bgcolor()
  • overlay concept
  • Custom moving averages
  • Colors, opacity, styles
  • User inputs
  • Multi-plot design
  • Professional visualization principles

1. Basics of Indicator Creation

//@version=5
indicator("My First Indicator", overlay=true)
plot(close)

2. The plot() Function

plot(
    series = close,
    color = color.new(color.blue, 0),
    linewidth = 2,
    title = "Price",
    style = plot.style_line
)

3. plotshape()

plotshape(longSignal, style=shape.labelup, color=color.green)
plotshape(shortSignal, style=shape.labeldown, color=color.red)

4. plotchar()

plotchar(longSignal, char="▲", location=location.belowbar)

5. barcolor() and bgcolor()

barcolor(close > open ? color.green : color.red)
bgcolor(color.new(color.yellow, 85))

6. overlay Concept

overlay=true → on price
overlay=false → separate panel


7. User Inputs

length = input.int(20, "Length")
src = input.source(close, "Source")
plot(ta.sma(src, length))

8. Professional Indicator Example

indicator("Advanced MA", overlay=true)
length = input.int(20)
src = input.source(close)
ma = ta.sma(src, length)

plot(ma, color=color.blue, linewidth=2)
plot(src, color=color.yellow)
barcolor(close > ma ? color.green : color.red)

9. Multiple plot() Usage

plot(ta.ema(close, 20))
plot(ta.ema(close, 50))
plot(ta.ema(close, 100))

10. Indicator in Separate Panel

indicator("Momentum", overlay=false)
mom = close - close[10]
plot(mom)

11. Open Editor

https://sancoqhub.com/go/tradingview


12. Premium Benefits

https://sancoqhub.com/go/tradingview


13. Conclusion

You now understand visual indicator creation.
Next chapter: Strategy Writing & Deep Strategy Tester Usage.