Manage Input variables with Pine Script v5

Welcome to this new tutorial that helps traders and investors better understand the powerful Pine Script programming language v5.

In this tutorial, we will program together three Input variables:

  1. Color type Input: a color input is a parameter that allows specifying a custom color for the indicator or script. It can be used to set the color of lines, areas, texts, or other graphical components in the indicator.
  2. Float type Input: a float input is a parameter that allows specifying a floating-point numerical value for the indicator or script. It can be used to set parameters such as threshold levels, indicator sizes, or any other numerical value that requires decimal precision.
  3. Integer type Input:an integer input is a parameter that allows specifying an integer numerical value for the indicator or script. It can be used to set parameters such as moving average periods, length of a time interval, or any other integer numerical value.


IMPORTANT: The code used in this tutorial has been created purely for educational purposes.

Our indicator is a simple indicator that plots the close data of the underlying asset on the chart in a weighted manner. The displayed data is the sum of the close price plus 20%. The goal of the indicator is to provide a fully dynamic tool that can vary its parameters from the user interface and update automatically.

Here is the complete code for this tutorial:




Indicates the version of the Pine Script language used in the code.


Set the name of the indicator as "Input Tutorial", and overlay=false indicates that the indicator should not overlap the main chart.


Create a float input called "pond" with a default value of 0.20. The input title is "Float", and the minimum value is 0.10, the maximum value is 1, and the step is 0.10.


Create a color input called "color_indicator" with a default value of red color. The input title is "Color".


Calculate a new value "data" by adding the closing price value with the closing price multiplied by the "pond" input.


Create an integer input called "linewidth_feature" with a default value of 1. The input title is "Integer", and the minimum value is 1, the maximum value is 10, and the step is 1.


Plot the chart of the closing value with the color specified by the "color_indicator" input and the line width specified by the "linewidth_feature" input.
Beyond Technical Analysiscolorfloatindicatorsintegerpinescriptvariable

Develop your Pine code NOW:
thequantscience.com
Auch am:

Haftungsausschluss