Step 3: Working with Data
FXC911 – Forex & Crypto News & Insights
Understanding Market Data
Pine Script provides access to OHLC (Open, High, Low, Close) data. You can use these built-in variables to reference the data.
//@version=5
indicator("OHLC Data", overlay=true)
plot(open, title="Open Price", color=color.orange)
plot(high, title="High Price", color=color.green)
plot(low, title="Low Price", color=color.red)
plot(close, title="Close Price", color=color.blue)

Built-in Functions
Pine Script includes many built-in functions to manipulate and analyze data.
//@version=5
indicator("Built-in Functions", overlay=true)
ma = ta.sma(close, 14) // Simple Moving Average
plot(ma, title="SMA 14", color=color.purple)

User Input
You can create inputs for users to customize the script.
//@version=5
indicator("User Input", overlay=true)
length = input.int(14, title="SMA Length")
ma = ta.sma(close, length)
plot(ma, title="SMA", color=color.purple)

Visit me on:
🚀 Finance & Trading Insights: fxc911.ir
🐦 Twitter: x.com/fxc911_official/
Last updated