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)
Understanding Market Data

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)
Simple Moving Average

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)
User Input

Visit me on:

Last updated