Resolution Input

FXC911 – Forex & Crypto News & Insights

Goals

This script is an indicator that plots the closing price of a security on the chart. The user can select the timeframe resolution (daily, weekly, or monthly) through the indicator's settings. The default resolution is daily ('D').

Pine Script Code

//@version=5
indicator("Input Resolution")

resolution = input.timeframe(defval = 'D', title = "Select Resolution", options=['D', 'W', 'M'])

plot(close)

Code Output

Explanation

//@version=5
  • Specifies that the script is using Pine Script version 5.

indicator("Input Resolution")
  • Defines the script as an indicator named "Input Resolution". This name will appear on the chart when you add this script as an indicator.

resolution = input.timeframe(defval = 'D', title = "Select Resolution", options=['D', 'W', 'M'])
  • input.timeframe is a function that creates a dropdown list in the indicator settings.

  • defval = 'D' sets the default value of this dropdown to 'D', which typically stands for daily timeframe.

  • title = "Select Resolution" is the label that appears next to the dropdown in the indicator settings.

  • options=['D', 'W', 'M'] specifies the options available in the dropdown: 'D' for daily, 'W' for weekly, and 'M' for monthly.

The result of this line is that the user can select a timeframe resolution (daily, weekly, or monthly) in the indicator settings, and this value is stored in the variable resolution.

plot(close)
  • plot(close) plots the closing price of the asset on the chart.

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:

Last updated