Color Input
FXC911 – Forex & Crypto News & Insights
Goals
This script is a simple indicator that plots the closing price of a security on the chart, and the user can customize the color of the plot through the indicator's settings. The default color is orange, but this can be changed by the user.
Pine Script Code
//@version=5
indicator("Input Color")
myColor = input.color(defval = color.orange, title = "Select Color")
plot(close, color = myColor)
Code Output

Explanation
//@version=5
This line specifies that the script is written in Pine Script version 5. This is necessary to ensure compatibility with the TradingView platform.
indicator("Input Color")
This line defines the script as an indicator and sets its name to "Input Color". The name will appear on the chart when you add this script as an indicator.
/yColor = input.color(defval = color.orange, title = "Select Color")
input.color
is a function that creates a color input field in the indicator settings.defval = color.orange
sets the default color to orange.title = "Select Color"
is the label that will appear next to the color picker in the indicator settings.
The result of this line is that the user can select a color in the indicator settings, and this color is stored in the variable myColor
.
plot(close, color = myColor)
plot(close, color = myColor)
plots the closing price of the asset on the chart.The color of the plot is determined by the value of
myColor
, which is set by the user through the color input.
Keywords
pine script
, trading view
, script editor
, indicators
, strategies
, backtesting
, alerts
, custom scripts
, stock analysis
, charting tools
, technical analysis
, built-in functions
, pine script syntax
, trading bots
, automated trading
, scripting language
, market data
, trading signals
, financial markets
, programming trading strategies
Visit me on:
🚀 Finance & Trading Insights: fxc911.ir
🐦 Twitter: x.com/fxc911_official/
Last updated