When creating a trading strategy or indicator in TradingView, we can add manual options to the script to easily change certain variables. How do we change and make these input settings?

In this article:

How to change the inputs of a TradingView script?

A useful feature in TradingView are input options. With them we can quickly change the values used by a script (like the length of a moving average). Since the current setting of an input option is stored in a variable (TradingView, n.d.), we don’t need to edit the script’s source code to change a certain value – all we need to do is manually adjusting the script’s setting.

We find those settings in the script’s ‘Inputs’ window. Let’s say we have the standard Donchian Channels indicator added to our chart like this:

Example of Donchian Channels indicator added to a TradingView chart

There are several ways in which we can change the inputs of an indicator or trading strategy. The first approach is to right-click on one of the plots and select ‘Format’:

Formatting an indicator in TradingView

Alternatively, we can click on the small sign that looks like a star or gear wheel ( ) and that’s located to the right of the script name:

Formatting a TradingView indicator with the 'Format' button

The last way is to double-click on one of the script’s plots like so:

Example of formatting an indicator in TradingView Pine

All three approaches bring us to the ‘Inputs’ window. The Donchian Channels indicator has one input there:

Input settings of the TradingView Donchian Channels indicator

Now that we know where to find the script’s settings, let’s look at creating our own input options.

Creating custom input options in TradingView

We begin the script inputs chapter with adding numerical inputs to a script. Those kind of inputs allow us to use integer (whole numbers) and floating-point (decimal) values, to for instance set the length of an oscillator or the offset of a price bands. Those numerical inputs look like:

Example of numerical inputs in TradingView

Another TradingView input option that we can make programmatically are true/false checkboxes. That option allows conditional features, like colouring the chart’s background when the checkbox is enabled:

Example of Boolean input checkboxes in TradingView

Creating a TradingView text box option is possible too, and we can use these settings for things like specifying any resolution or entering an instrument’s symbol:

Example of string input options in TradingView

In the next article we discuss creating a session setting in TradingView. Those time range options look like:

Example of session inputs in TradingView Pine

Another kind of input is the symbol search box. That text field in the script’s input settings works just like the regular symbol search box that we use to switch the chart to another symbol. A symbol search box input option looks like:

Example of symbol inputs in TradingView Pine

The next article in the chapter looks at creating a resolution pull-down menu, which contains several common resolution options. This kind of option looks like this in the ‘Inputs’ menu:

Example of resolution inputs in TradingView Pine

The last input option discussed in this chapter is the source input option. That input is used in TradingView to select a type of data from the chart’s data series (like the high, low, or open prices) (Pine Script Language Tutorial, n.d.). This option looks as follows:

Example of source inputs in TradingView Pine

We end the chapter with a summary of input options in TradingView, in which we recap the most important code features.


Pine Script Language Tutorial (n.d.). Retrieved on August 13, 2015, from https://docs.google.com/document/d/1sCfC873xJEMV7MGzt1L70JTStTE9kcG2q-LDuWWkBeY/

TradingView (n.d.). Script Language Reference Manual. Retrieved on October 23, 2015, from https://www.tradingview.com/study-script-reference/